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

Class Test

tests/testing/run_image_tests.py:99–358  ·  view source on GitHub ↗

Represents a single image test.

Source from the content-addressed store, hash-verified

97 return {}
98
99class Test:
100 '''
101 Represents a single image test.
102 '''
103
104 class Result(Enum):
105 PASSED = 1
106 FAILED = 2
107 SKIPPED = 3
108
109 COLORED_RESULT_STRING = {
110 Result.PASSED: colored('PASSED', 'green'),
111 Result.FAILED: colored('FAILED', 'red'),
112 Result.SKIPPED: colored('SKIPPED', 'yellow')
113 }
114
115 RESULT_STRING = {
116 Result.PASSED: 'PASSED',
117 Result.FAILED: 'FAILED',
118 Result.SKIPPED: 'SKIPPED'
119 }
120
121 process_controller = None
122
123 def __init__(self, script_file, root_dir: Path, device_type, header):
124 self.script_file = script_file
125 self.device_type = device_type
126 self.header = header
127
128 # Test name.
129 self.name = str(self.script_file.relative_to(root_dir).with_suffix('').as_posix()) + f"_{self.device_type}"
130
131 # Test directory relative to root directory.
132 self.test_dir = Path(self.name)
133
134 # Get tags.
135 self.tags = self.header.get('tags', ['default'])
136
137 # Get skipped tests.
138 self.skip_message = self.header.get('skipped', None)
139 self.skipped = self.skip_message != None
140
141 # Get tolerance.
142 self.tolerance = self.header.get('tolerance', config.DEFAULT_TOLERANCE)
143
144 # Get timeout.
145 self.timeout = self.header.get('timeout', config.DEFAULT_TIMEOUT)
146
147 def __repr__(self):
148 return f'Test(name={self.name},script_file={self.script_file})'
149
150 def matches_tags(self, tags):
151 '''
152 Check if the test's tags matches any of the given tags.
153 '''
154 for tag in self.tags:
155 if tag in tags:
156 return True

Callers 1

collect_testsFunction · 0.70

Calls 1

coloredFunction · 0.90

Tested by 1

collect_testsFunction · 0.56