6
from testrepository.testlist import parse_list, write_list
8
parser = argparse.ArgumentParser(
9
description="Test runner that supports both Python 2 and Python 3.")
12
"--load-list", metavar="PATH", help="Path to read list of tests to run from.",
15
"--list", help="List available tests.", action="store_true")
17
args = parser.parse_args()
20
subprocess.call(['python', './brz', 'selftest', '--subunit2', '--list'])
21
subprocess.call(['python3', './brz', 'selftest', '--subunit2', '--list'])
26
with open(args.load_list, 'r') as f:
27
all_tests = parse_list(f.read())
28
for testname in all_tests:
29
if testname.startswith("python2."):
30
py2_tests.append(testname[len('python2.'):].strip())
31
elif testname.startswith("python3."):
32
py3_tests.append(testname[len('python3.'):].strip())
34
sys.stderr.write("unknown prefix %s\n" % testname)
37
with tempfile.NamedTemporaryFile() as py2f:
38
write_list(py2f, py2_tests)
41
'python ./brz selftest --subunit2 --load-list=%s | subunit-filter -s --passthrough --rename "^" "python2."' % py2f.name, shell=True)
44
with tempfile.NamedTemporaryFile() as py3f:
45
write_list(py3f, py3_tests)
48
'python ./brz selftest --subunit2 --load-list=%s | subunit-filter -s --passthrough --rename "^" "python3."' % py3f.name, shell=True)
51
'python ./brz selftest --subunit2 | subunit-filter -s --passthrough --rename "^" "python2."', shell=True)
53
'python ./brz selftest --subunit2 | subunit-filter -s --passthrough --rename "^" "python3."', shell=True)