| 488 | |
| 489 | |
| 490 | def gather_test_cases(test_dir, pattern, list_tests): |
| 491 | test_dir = test_dir.split(',') |
| 492 | test_suite = unittest.TestSuite() |
| 493 | for _test_dir in test_dir: |
| 494 | _test_dir = os.path.abspath(_test_dir) |
| 495 | case_list = [] |
| 496 | for dirpath, dirnames, filenames in os.walk(_test_dir): |
| 497 | for file in filenames: |
| 498 | if fnmatch(file, pattern): |
| 499 | case_list.append(file) |
| 500 | |
| 501 | for case in case_list: |
| 502 | test_case = unittest.defaultTestLoader.discover( |
| 503 | start_dir=_test_dir, pattern=case, top_level_dir=PROJECT_ROOT) |
| 504 | test_suite.addTest(test_case) |
| 505 | if hasattr(test_case, '__iter__'): |
| 506 | for subcase in test_case: |
| 507 | if list_tests: |
| 508 | print(subcase) |
| 509 | else: |
| 510 | if list_tests: |
| 511 | print(test_case) |
| 512 | return test_suite |
| 513 | |
| 514 | |
| 515 | def print_abnormal_case_info(df): |