pyodide/test/make_test_list.py

29 lines
715 B
Python
Raw Normal View History

2018-04-09 14:39:52 +00:00
"""
Generate a list of test modules in the CPython distribution.
"""
import os
2018-08-03 16:48:22 +00:00
from pathlib import Path
2018-04-09 14:39:52 +00:00
tests = []
2018-08-03 16:48:22 +00:00
TEST_DIR = Path("../cpython/build/3.6.4/host/lib/python3.6/test")
for root, dirs, files in os.walk(
"../cpython/build/3.6.4/host/lib/python3.6/test"):
2018-08-03 16:48:22 +00:00
root = Path(root).relative_to(TEST_DIR)
2018-04-09 14:39:52 +00:00
if root == '.':
root = ''
else:
root = '.'.join(root.split('/')) + '.'
for filename in files:
2018-08-03 16:48:22 +00:00
filename = Path(filename)
if str(filename).startswith("test_") and filename.suffix == ".py":
2018-08-06 14:01:28 +00:00
tests.append(str(root / filename.stem))
2018-04-09 14:39:52 +00:00
tests.sort()
with open("python_tests.txt", "w") as fp:
for test in tests:
fp.write(test + '\n')