diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-09-05 06:54:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 06:54:12 (GMT) |
commit | 492e1ffdce3edd741aaf9f7a89f645a2256b70e4 (patch) | |
tree | ecc7f4cadb9a954b46fbdaf1b62c819d4bfd0e5c /Lib/test/libregrtest | |
parent | 562c1688565643bad13477610d6f8825fec0698c (diff) | |
download | cpython-492e1ffdce3edd741aaf9f7a89f645a2256b70e4.zip cpython-492e1ffdce3edd741aaf9f7a89f645a2256b70e4.tar.gz cpython-492e1ffdce3edd741aaf9f7a89f645a2256b70e4.tar.bz2 |
[3.11] gh-89392: Remove support of test_main() in libregrtest (GH-108876) (GH-108898)
(cherry picked from commit 04a0830b00879efe057e3dfe75e9aa9c0caf1a26)
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r-- | Lib/test/libregrtest/runtest.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/libregrtest/runtest.py b/Lib/test/libregrtest/runtest.py index 8ca7b8b..e73a8f1 100644 --- a/Lib/test/libregrtest/runtest.py +++ b/Lib/test/libregrtest/runtest.py @@ -341,11 +341,10 @@ def _load_run_test(result: TestResult, ns: Namespace) -> None: the_module = importlib.import_module(abstest) - # If the test has a test_main, that will run the appropriate - # tests. If not, use normal unittest test loading. - test_func = getattr(the_module, "test_main", None) - if test_func is None: - test_func = functools.partial(_test_module, the_module) + if hasattr(the_module, "test_main"): + # https://github.com/python/cpython/issues/89392 + raise Exception(f"Module {result.test_name} defines test_main() which is no longer supported by regrtest") + test_func = functools.partial(_test_module, the_module) try: with save_env(ns, result.test_name): |