Skip to content
Prev Previous commit
Debug
  • Loading branch information
VanshAgarwal24036 committed Jan 21, 2026
commit 73a161a0341cb2f8acd4aea73d891eb1bc1b0a8e
15 changes: 7 additions & 8 deletions Lib/test/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ def load_tests(loader, tests, pattern):
pure_tests = import_fresh_module(TESTS,
fresh=['datetime', '_pydatetime', '_strptime'],
blocked=['_datetime'])
fast_tests = import_fresh_module(TESTS,
fresh=['datetime', '_strptime'],
blocked=['_pydatetime'])
fast_tests = None
if has_datetime_ext:
fast_tests = import_fresh_module(TESTS,
fresh=['datetime', '_strptime'],
blocked=['_pydatetime'])
finally:
# XXX: import_fresh_module() is supposed to leave sys.module cache untouched,
# XXX: but it does not, so we have to cleanup ourselves.
for modname in ['datetime', '_datetime', '_pydatetime', '_strptime']:
sys.modules.pop(modname, None)

test_modules = [pure_tests, fast_tests]
test_suffixes = ["_Pure", "_Fast"]
test_modules = [pure_tests]
Comment thread
VanshAgarwal24036 marked this conversation as resolved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the accelerated module is not tested at all.

test_suffixes = ["_Pure"]

# XXX(gb) First run all the _Pure tests, then all the _Fast tests. You might
# not believe this, but in spite of all the sys.modules trickery running a _Pure
Expand All @@ -52,9 +54,6 @@ def load_tests(loader, tests, pattern):
class Wrapper(cls):
@classmethod
def setUpClass(cls_, module=module):
if module is fast_tests and not has_datetime_ext:
raise unittest.SkipTest("requires _datetime module")

cls_._save_sys_modules = sys.modules.copy()
sys.modules[TESTS] = module
sys.modules['datetime'] = module.datetime_module
Expand Down
Loading