Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit c24b78b

Browse files
committed
use docstrings
1 parent 025e9a7 commit c24b78b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

packages/unittest_runner/unittest_runner/run_tests.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
import unittest
22
from .validation_runner import ValidationTestResult
33

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'}, ...]
84
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+
"""
918
result = run_tests(file_pattern, ValidationTestResult)
1019
return result.simplified_results
1120

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+
1422
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+
"""
1530
run_tests(file_pattern, unittest.TextTestResult)
1631

1732
def run_tests(file_pattern, resultclass):

0 commit comments

Comments
 (0)