Skip to content

Commit 73a161a

Browse files
Debug
1 parent b589068 commit 73a161a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Lib/test/test_datetime.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ def load_tests(loader, tests, pattern):
1818
pure_tests = import_fresh_module(TESTS,
1919
fresh=['datetime', '_pydatetime', '_strptime'],
2020
blocked=['_datetime'])
21-
fast_tests = import_fresh_module(TESTS,
22-
fresh=['datetime', '_strptime'],
23-
blocked=['_pydatetime'])
21+
fast_tests = None
22+
if has_datetime_ext:
23+
fast_tests = import_fresh_module(TESTS,
24+
fresh=['datetime', '_strptime'],
25+
blocked=['_pydatetime'])
2426
finally:
2527
# XXX: import_fresh_module() is supposed to leave sys.module cache untouched,
2628
# XXX: but it does not, so we have to cleanup ourselves.
2729
for modname in ['datetime', '_datetime', '_pydatetime', '_strptime']:
2830
sys.modules.pop(modname, None)
2931

30-
test_modules = [pure_tests, fast_tests]
31-
test_suffixes = ["_Pure", "_Fast"]
32+
test_modules = [pure_tests]
33+
test_suffixes = ["_Pure"]
3234

3335
# XXX(gb) First run all the _Pure tests, then all the _Fast tests. You might
3436
# not believe this, but in spite of all the sys.modules trickery running a _Pure
@@ -52,9 +54,6 @@ def load_tests(loader, tests, pattern):
5254
class Wrapper(cls):
5355
@classmethod
5456
def setUpClass(cls_, module=module):
55-
if module is fast_tests and not has_datetime_ext:
56-
raise unittest.SkipTest("requires _datetime module")
57-
5857
cls_._save_sys_modules = sys.modules.copy()
5958
sys.modules[TESTS] = module
6059
sys.modules['datetime'] = module.datetime_module

0 commit comments

Comments
 (0)