Bug report
Bug description:
Six tests in test_unittest.test_program fail when the test suite is run with -X lazy_imports=all:
./python -X lazy_imports=all -m test test_unittest
ERROR: test_Exit (test.test_unittest.test_program.Test_TestProgram.test_Exit)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Lib/test/test_unittest/test_program.py", line 150, in test_Exit
unittest.main(
~~~~~~~~~~~~~^
argv=["foobar"],
...
TypeError: 'module' object is not callable
The same error occurs in test_ExitAsDefault, test_ExitEmptySuite, test_ExitSetUpClassFailureSuite, test_ExitSkippedSuite and test_NonExit.
unittest.main resolves to the unittest.main submodule instead of the unittest.main.TestProgram class.
Without -X lazy_imports=all the tests pass.
Build configuration:
CC=clang-21 CXX=clang++-21 LDFLAGS='-fuse-ld=lld-21' ./configure --enable-experimental-jit=yes
CPython versions tested on:
CPython main branch, 3.16
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
Six tests in
test_unittest.test_programfail when the test suite is run with-X lazy_imports=all:./python -X lazy_imports=all -m test test_unittestThe same error occurs in
test_ExitAsDefault,test_ExitEmptySuite,test_ExitSetUpClassFailureSuite,test_ExitSkippedSuiteandtest_NonExit.unittest.mainresolves to theunittest.mainsubmodule instead of theunittest.main.TestProgramclass.Without
-X lazy_imports=allthe tests pass.Build configuration:
CC=clang-21 CXX=clang++-21 LDFLAGS='-fuse-ld=lld-21' ./configure --enable-experimental-jit=yesCPython versions tested on:
CPython main branch, 3.16
Operating systems tested on:
Linux
Linked PRs