Skip to content

Commit f173943

Browse files
committed
Allow test case filtering by class name
It sometimes is useful to run either all tests from a class or a specific test from a class where the name might also be used in another class. Use the common convention of '<class>.<test>' and match aginst that allowing e.g. "TypeCheckingTest.test_check_type" as a filter.
1 parent 6e68abe commit f173943

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/framework/utilities.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ def loadTestsFromTestCase(self, test_case_class, filters):
430430
retained_test_names = []
431431
if len(filters) > 0:
432432
for test_case_name in test_case_names:
433-
if any(filt in test_case_name for filt in filters):
433+
full_test_case_name = '%s.%s' % (test_case_class.__name__, test_case_name)
434+
if any(filt in full_test_case_name for filt in filters):
434435
retained_test_names.append(test_case_name)
435436

436437
retained_tests = ', '.join(retained_test_names)

0 commit comments

Comments
 (0)