mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
* Preserve regression collector outcomes and canonical process context Record complete test identities, subtest diagnostics and fixture outcomes while keeping unittest event counts separate from once-per-case JSON totals. Reuse canonical process setup and avoid an unnecessary library-path override. Assisted-by: OpenAI Codex: model version unavailable * Fix regression runner subtest formatting and qualified discovery Assisted-by: OpenAI Codex: model version unavailable * Make runner traceback assertions independent of forced colors Assisted-by: OpenAI Codex: model version unavailable * Keep dev VM frames compact for stdlib imports Carry the established integration VM optimization override into the regression runner split. Retain debug assertions, stack guards and Python recursion limits. Assisted-by: OpenAI Codex: model version unavailable
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
import os
|
|
import unittest
|
|
|
|
from custom_text_test_runner import CustomTextTestRunner as Runner
|
|
from test.libregrtest.findtests import findtests
|
|
from test.libregrtest.setup import setup_process
|
|
|
|
|
|
def loadTestsOrSkip(loader, name):
|
|
if not name.startswith("test."):
|
|
name = "test." + name
|
|
try:
|
|
return loader.loadTestsFromName(name)
|
|
except unittest.SkipTest as exc:
|
|
# from _make_skipped_test from unittest/loader.py
|
|
@unittest.skip(str(exc))
|
|
def testSkipped(self):
|
|
pass
|
|
|
|
attrs = {name: testSkipped}
|
|
TestClass = type("ModuleSkipped", (unittest.TestCase,), attrs)
|
|
return loader.suiteClass((TestClass(name),))
|
|
|
|
|
|
def main():
|
|
setup_process()
|
|
testnames = findtests()
|
|
# idk why this fixes the hanging, if it does
|
|
testnames.remove("test_importlib")
|
|
testnames.insert(0, "test_importlib")
|
|
|
|
loader = unittest.defaultTestLoader
|
|
suite = loader.suiteClass([loadTestsOrSkip(loader, name) for name in testnames])
|
|
|
|
resultsfile = os.path.join(os.path.dirname(__file__), "cpython_tests_results.json")
|
|
if os.path.exists(resultsfile):
|
|
os.remove(resultsfile)
|
|
|
|
runner = Runner(results_file_path=resultsfile, verbosity=2)
|
|
runner.run(suite)
|
|
|
|
print("Done! results are available in", resultsfile)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|