gh-143959: Split datetime tests requiring _datetime by VanshAgarwal24036 · Pull Request #143997 · python/cpython
I hacked Python to build again _datetime as an extension module and I removed ./build/lib.linux-x86_64-3.15/_datetime.cpython-315d-x86_64-linux-gnu.so.
Result: test_datetime fails.
0:00:00 load avg: 1.15 [1/1] test_datetime
Failed to call load_tests:
Traceback (most recent call last):
File "/home/vstinner/python/main/Lib/unittest/loader.py", line 113, in loadTestsFromModule
return load_tests(self, tests, pattern)
File "/home/vstinner/python/main/Lib/test/test_datetime.py", line 38, in load_tests
for name, cls in module.__dict__.items():
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__dict__'. Did you mean: '__dir__'?
test test_datetime crashed -- Traceback (most recent call last):
File "/home/vstinner/python/main/Lib/test/libregrtest/single.py", line 210, in _runtest_env_changed_exc
_load_run_test(result, runtests)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/test/libregrtest/single.py", line 165, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/test/libregrtest/single.py", line 118, in regrtest_runner
test_result = test_func()
File "/home/vstinner/python/main/Lib/test/libregrtest/single.py", line 162, in test_func
return run_unittest(test_mod, runtests)
File "/home/vstinner/python/main/Lib/test/libregrtest/single.py", line 38, in run_unittest
raise Exception("errors while loading tests")
Exception: errors while loading tests
0:00:00 load avg: 1.15 [1/1/1] test_datetime failed (uncaught exception)
I'm not convinced that this change works as expected.