MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / collect_tests

Function collect_tests

tests/testing/run_image_tests.py:531–570  ·  view source on GitHub ↗

Collect a list of all tests found in root_dir that are matching the filter_regex and tags. A test script needs to be named test_*.py to be detected.

(root_dir, filter_regex, tags)

Source from the content-addressed store, hash-verified

529 print(f' {test.name}')
530
531def collect_tests(root_dir, filter_regex, tags)->list[Test]:
532 '''
533 Collect a list of all tests found in root_dir that are matching the filter_regex and tags.
534 A test script needs to be named test_*.py to be detected.
535 '''
536 # Find all script files.
537 script_files = list(root_dir.glob('**/test_*.py'))
538
539 # Create tests.
540 tests = []
541 for script_file in script_files:
542 try:
543 header = read_header(script_file)
544 except Exception as e:
545 print(e)
546 sys.exit(1)
547
548 # Check if test is enabled for current platform.
549 platforms = header.get("platforms", config.DEFAULT_PLATFORMS)
550 if not config.PLATFORM in platforms:
551 continue
552
553 # For now we default to d3d12 as we bring in image tests on vulkan.
554 # We should later switch this default to ["d3d12", "vulkan"].
555 device_types = header.get("device_types", ["d3d12"])
556 device_types = [d for d in device_types if d in config.SUPPORTED_DEVICE_TYPES]
557 for device_type in device_types:
558 tests.append(Test(script_file, root_dir, device_type, header))
559
560 # Filter using regex.
561 if filter_regex != '':
562 regex = re.compile(filter_regex or '')
563 tests = list(filter(lambda t: regex.search(t.name) != None, tests))
564
565 # Filter using tags.
566 tags = tags.split(',')
567 tests = list(filter(lambda t: t.matches_tags(tags), tests))
568 tests = sorted(tests, key=lambda t: t.name)
569
570 return tests
571
572def push_refs(ref_dir, remote_ref_dir):
573 '''

Callers 1

mainFunction · 0.85

Calls 9

listClass · 0.85
read_headerFunction · 0.85
exitMethod · 0.80
searchMethod · 0.80
matches_tagsMethod · 0.80
TestClass · 0.70
getMethod · 0.45
appendMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected