test_mod = importlib.import_module(module_name)
- # If the test has a test_main, that will run the appropriate
- # tests. If not, use normal unittest test runner.
- test_main = getattr(test_mod, "test_main", None)
- if test_main is not None:
- test_func = test_main
- else:
- def test_func():
- return run_unittest(test_mod)
+ if hasattr(test_mod, "test_main"):
+ # https://github.com/python/cpython/issues/89392
+ raise Exception("Module {result.test_name} defines test_main() which is no longer supported by regrtest")
+ def test_func():
+ return run_unittest(test_mod)
try:
with save_env(ns, result.test_name):
7948648
"""
- def test_main():
- testmod = sys.modules[__name__]
- return support.run_doctest(testmod)
+ def load_tests(loader, tests, pattern):
+ tests.addTest(doctest.DocTestSuite())
+ return tests
''')
testname = self.create_test(code=code)
self.check_executed_tests(output, [testname],
failed=[testname],
randomize=True,
- stats=TestStats(4, 2, 1))
+ stats=TestStats(1, 1, 0))
class TestUtils(unittest.TestCase):