MCPcopy Index your code
hub / github.com/modelscope/modelscope / gather_test_cases

Function gather_test_cases

tests/run.py:490–512  ·  view source on GitHub ↗
(test_dir, pattern, list_tests)

Source from the content-addressed store, hash-verified

488
489
490def 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
515def print_abnormal_case_info(df):

Callers 1

mainFunction · 0.85

Calls 2

printFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…