pyodide/test/make_test_list.py

29 lines
715 B
Python

"""
Generate a list of test modules in the CPython distribution.
"""
import os
from pathlib import Path
tests = []
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"):
root = Path(root).relative_to(TEST_DIR)
if root == '.':
root = ''
else:
root = '.'.join(root.split('/')) + '.'
for filename in files:
filename = Path(filename)
if str(filename).startswith("test_") and filename.suffix == ".py":
tests.append(str(root / filename.stem))
tests.sort()
with open("python_tests.txt", "w") as fp:
for test in tests:
fp.write(test + '\n')