MCPcopy Create free account
hub / github.com/catchorg/Catch2 / list_tests

Function list_tests

tests/TestScripts/testRandomOrder.py:29–49  ·  view source on GitHub ↗
(self_test_exe, tags, rng_seed)

Source from the content-addressed store, hash-verified

27 return e
28
29def list_tests(self_test_exe, tags, rng_seed):
30 cmd = [self_test_exe, '--reporter', 'xml', '--list-tests', '--order', 'rand',
31 '--rng-seed', str(rng_seed)]
32 tags_arg = ','.join('[{}]~[.]'.format(t) for t in tags)
33 if tags_arg:
34 cmd.append(tags_arg)
35 process = subprocess.Popen(
36 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
37 stdout, stderr = process.communicate()
38 if stderr:
39 raise RuntimeError("Unexpected error output:\n" + process.stderr)
40
41 root = ET.fromstring(stdout)
42 result = [(none_to_empty_str(tc.find('Name').text),
43 none_to_empty_str(tc.find('Tags').text),
44 none_to_empty_str(tc.find('ClassName').text)) for tc in root.findall('./TestCase')]
45
46 if len(result) < 2:
47 raise RuntimeError("Unexpectedly few tests listed (got {})".format(
48 len(result)))
49 return result
50
51def check_is_sublist_of(shorter, longer):
52 assert len(shorter) < len(longer)

Callers 1

mainFunction · 0.70

Calls 2

none_to_empty_strFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected