Files
RustPython/extra_tests/jsontests.py
Lee Dogeon 6cb763a332 Fix some parts of cron-ci workflow (#6724)
* Use shared PYTHON_VERSION in cron-ci benchmark job

* Correct extra-tests/jsontests.py script

When the `extra_tests/jsontests.py` script was added, it was presumably during
the time when Python versions 3.5 to 3.8 were in use. At that time,
`test.libregrtest.runtest` was a valid path, but from CPython version 3.11
onwards, the path changed to `test.libregrtest.findtests`.

* Use ssl-rustls feature instead of ssl in cron-ci workflow

Replace the ssl feature with ssl-rustls in both the CARGO_ARGS
environment variable and the cargo-llvm-cov test command to fix
the cron-ci workflow.

Since 1a783fc9ec, it is disallowed
to use ssl manually.

* Replace inspect.getargspec with inspect.getfullargspec in custom_text_test_runner

inspect.getargspec() was removed in Python 3.11, causing jsontests.py to
fail with "TypeError: 'NoneType' object is not iterable" when running on
RustPython (which targets Python 3.13).

The get_function_args() function was silently catching the AttributeError
and returning None, which then caused the error in store_class_fields()
when trying to iterate over None.

> https://docs.python.org/3/whatsnew/3.11.html
> The getargspec() function, deprecated since Python 3.0; use
> inspect.signature() or inspect.getfullargspec() instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Exclude rustpython-venvlauncher in cron-ci workflow

Since rustpython-venvlauncher is Windows-only,
it disables the project in the cron-ci workflow.

* Apply suggestion from @fanninpm

Co-authored-by: fanninpm <luxverdans@sbcglobal.net>

* Trigger cron-ci workflow in pull_request

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
Co-authored-by: fanninpm <luxverdans@sbcglobal.net>
2026-01-14 13:28:25 +09:00

40 lines
1.1 KiB
Python

import os
import unittest
from custom_text_test_runner import CustomTextTestRunner as Runner
from test.libregrtest.findtests import findtests
testnames = findtests()
# idk why this fixes the hanging, if it does
testnames.remove("test_importlib")
testnames.insert(0, "test_importlib")
def loadTestsOrSkip(loader, 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),))
loader = unittest.defaultTestLoader
suite = loader.suiteClass(
[loadTestsOrSkip(loader, "test." + 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)