Skip to content

Commit f7149af

Browse files
authored
Revert "bpo-30822: Fix testing of datetime module. (#2530)"
This reverts commit 98b6bc3.
1 parent bc551d3 commit f7149af

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

Lib/datetime.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,8 +2271,7 @@ def _name_from_offset(delta):
22712271
_check_tzinfo_arg, _check_tzname, _check_utc_offset, _cmp, _cmperror,
22722272
_date_class, _days_before_month, _days_before_year, _days_in_month,
22732273
_format_time, _is_leap, _isoweek1monday, _math, _ord2ymd,
2274-
_time, _time_class, _tzinfo_class, _wrap_strftime, _ymd2ord,
2275-
_divide_and_round)
2274+
_time, _time_class, _tzinfo_class, _wrap_strftime, _ymd2ord)
22762275
# XXX Since import * above excludes names that start with _,
22772276
# docstring does not get overwritten. In the future, it may be
22782277
# appropriate to maintain a single module level docstring and

Lib/test/datetimetester.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ def test_constants(self):
6161
self.assertEqual(datetime.MAXYEAR, 9999)
6262

6363
def test_name_cleanup(self):
64-
if '_Pure' in self.__class__.__name__:
65-
self.skipTest('Only run for Fast C implementation')
66-
64+
if '_Fast' not in str(self):
65+
return
6766
datetime = datetime_module
6867
names = set(name for name in dir(datetime)
6968
if not name.startswith('__') and not name.endswith('__'))
@@ -73,9 +72,8 @@ def test_name_cleanup(self):
7372
self.assertEqual(names - allowed, set([]))
7473

7574
def test_divide_and_round(self):
76-
if '_Fast' in self.__class__.__name__:
77-
self.skipTest('Only run for Pure Python implementation')
78-
75+
if '_Fast' in str(self):
76+
return
7977
dar = datetime_module._divide_and_round
8078

8179
self.assertEqual(dar(-10, -3), 3)
@@ -2853,7 +2851,7 @@ def tzname(self, dt): return self.tz
28532851
self.assertRaises(TypeError, t.strftime, "%Z")
28542852

28552853
# Issue #6697:
2856-
if '_Fast' in self.__class__.__name__:
2854+
if '_Fast' in str(self):
28572855
Badtzname.tz = '\ud800'
28582856
self.assertRaises(ValueError, t.strftime, "%Z")
28592857

Lib/test/test_datetime.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# XXX(gb) First run all the _Pure tests, then all the _Fast tests. You might
2121
# not believe this, but in spite of all the sys.modules trickery running a _Pure
2222
# test last will leave a mix of pure and native datetime stuff lying around.
23-
all_test_classes = []
23+
test_classes = []
2424

2525
for module, suffix in zip(test_modules, test_suffixes):
2626
test_classes = []
@@ -33,8 +33,7 @@
3333
suit = cls()
3434
test_classes.extend(type(test) for test in suit)
3535
for cls in test_classes:
36-
cls.__name__ += suffix
37-
cls.__qualname__ += suffix
36+
cls.__name__ = name + suffix
3837
@classmethod
3938
def setUpClass(cls_, module=module):
4039
cls_._save_sys_modules = sys.modules.copy()
@@ -47,10 +46,9 @@ def tearDownClass(cls_):
4746
sys.modules.update(cls_._save_sys_modules)
4847
cls.setUpClass = setUpClass
4948
cls.tearDownClass = tearDownClass
50-
all_test_classes.extend(test_classes)
5149

5250
def test_main():
53-
run_unittest(*all_test_classes)
51+
run_unittest(*test_classes)
5452

5553
if __name__ == "__main__":
5654
test_main()

Misc/ACKS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,6 @@ Doobee R. Tzeck
16021602
Eren Türkay
16031603
Lionel Ulmer
16041604
Adnan Umer
1605-
Utkarsh Upadhyay
16061605
Roger Upole
16071606
Daniel Urban
16081607
Michael Urman

0 commit comments

Comments
 (0)