Handle full unique test identifiers in testRandomOrder.py

This commit is contained in:
Martin Hořeňovský 2022-01-27 18:57:48 +01:00
parent dc86d51af2
commit d861e73f86
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -13,6 +13,12 @@ import sys
import random
import xml.etree.ElementTree as ET
def none_to_empty_str(e):
if e is None:
return ""
assert type(e) is str
return e
def list_tests(self_test_exe, tags, rng_seed):
cmd = [self_test_exe, '--reporter', 'xml', '--list-tests', '--order', 'rand',
'--rng-seed', str(rng_seed)]
@ -26,7 +32,9 @@ def list_tests(self_test_exe, tags, rng_seed):
raise RuntimeError("Unexpected error output:\n" + process.stderr)
root = ET.fromstring(stdout)
result = [elem.text for elem in root.findall('./TestCase/Name')]
result = [(none_to_empty_str(tc.find('Name').text),
none_to_empty_str(tc.find('Tags').text),
none_to_empty_str(tc.find('ClassName').text)) for tc in root.findall('./TestCase')]
if len(result) < 2:
raise RuntimeError("Unexpectedly few tests listed (got {})".format(