|
1 | 1 | import unittest
|
2 | 2 | from .validation_runner import ValidationTestResult
|
3 | 3 |
|
4 |
| -# Run the tests in the given file pattern and display the results to the user. |
5 |
| -# Validation tests use the ValidationTestResult class to display only the short description of the test. |
6 |
| -# This also returns simplified results for the caller to use. Simplified results is a list of the form: |
7 |
| -# [{'name': 'test_name', 'result': 'PASS/FAIL/ERROR/SKIP/EXPECTED_FAILURE/UNEXPECTED_SUCCESS'}, ...] |
8 | 4 | def run_validation_tests(file_pattern):
|
| 5 | + """ |
| 6 | + Run the tests matching the given file pattern and display the results to the user. |
| 7 | + Validation tests use the ValidationTestResult class to display only the short description of the test. |
| 8 | +
|
| 9 | + Args: |
| 10 | + file_pattern (str): A glob pattern to match test files. |
| 11 | +
|
| 12 | + Returns: |
| 13 | + List[Dict[str, str]]: A simplified list of test results with each entry containing: |
| 14 | + - 'name': The name of the test. |
| 15 | + - 'result': The outcome, which is one of the following: |
| 16 | + 'PASS', 'FAIL', 'ERROR', 'SKIP', 'EXPECTED_FAILURE', 'UNEXPECTED_SUCCESS'. |
| 17 | + """ |
9 | 18 | result = run_tests(file_pattern, ValidationTestResult)
|
10 | 19 | return result.simplified_results
|
11 | 20 |
|
12 |
| -# Run the tests in the given file pattern and display the results to the user. |
13 |
| -# Student tests use the standard TextTestResult class to display the test name and short description. |
| 21 | + |
14 | 22 | def run_student_tests(file_pattern):
|
| 23 | + """ |
| 24 | + Run the tests in the given file pattern and display the results to the user. |
| 25 | + Student tests use the standard TextTestResult class to display the test name and short description. |
| 26 | + |
| 27 | + Args: |
| 28 | + file_pattern (str): A glob pattern to match test files. |
| 29 | + """ |
15 | 30 | run_tests(file_pattern, unittest.TextTestResult)
|
16 | 31 |
|
17 | 32 | def run_tests(file_pattern, resultclass):
|
|
0 commit comments