(test_dir, pattern, list_tests)
| 13 | |
| 14 | |
| 15 | def gather_test_cases(test_dir, pattern, list_tests): |
| 16 | case_list = [] |
| 17 | for dirpath, dirnames, filenames in os.walk(test_dir): |
| 18 | for file in filenames: |
| 19 | if fnmatch(file, pattern): |
| 20 | case_list.append(file) |
| 21 | |
| 22 | test_suite = unittest.TestSuite() |
| 23 | |
| 24 | for case in case_list: |
| 25 | test_case = unittest.defaultTestLoader.discover(start_dir=test_dir, pattern=case) |
| 26 | test_suite.addTest(test_case) |
| 27 | if hasattr(test_case, "__iter__"): |
| 28 | for subcase in test_case: |
| 29 | if list_tests: |
| 30 | print(subcase) |
| 31 | else: |
| 32 | if list_tests: |
| 33 | print(test_case) |
| 34 | return test_suite |
| 35 | |
| 36 | |
| 37 | def main(args): |
no outgoing calls
no test coverage detected
searching dependent graphs…