Skip to content

Commit 8207c17

Browse files
authored
Revert "bpo-30822: Fix testing of datetime module." (#2588)
* Revert "bpo-30854: Fix compile error when --without-threads (#2581)" This reverts commit 0c31163. * Revert "NEWS for 30777 (#2576)" This reverts commit aaa917f. * Revert "bpo-21624: IDLE -- minor htest fixes (#2575)" This reverts commit 2000150. * Revert "bpo-30777: IDLE: configdialog - add docstrings and improve comments (#2440)" This reverts commit 7eb5883. * Revert "bpo-30319: socket.close() now ignores ECONNRESET (#2565)" This reverts commit 67e1478. * Revert "bpo-30789: Use a single memory block for co_extra. (#2555)" This reverts commit 378ebb6. * Revert "bpo-30845: Enhance test_concurrent_futures cleanup (#2564)" This reverts commit 3df9dec. * Revert "bpo-29293: multiprocessing.Condition.notify() lacks parameter `n` (#2480)" This reverts commit 4835041. * Revert "Remove outdated FOX from GUI FAQ (GH-2538)" This reverts commit d3ed287. * Revert "bpo-6691: Pyclbr now reports nested classes and functions. (#2503)" This reverts commit 246ff3b. * Revert "bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)" This reverts commit 6969eaf. * Revert "bpo-30832: Remove own implementation for thread-local storage (#2537)" This reverts commit aa0aa04. * Revert "bpo-30764: Fix regrtest --fail-env-changed --forever (#2536)" This reverts commit 5e87592. * Revert "bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (#2534)" This reverts commit 34b5487. * Revert "bpo-30822: Fix testing of datetime module. (#2530)" This reverts commit 98b6bc3.
1 parent 0c31163 commit 8207c17

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 = []
@@ -34,8 +34,7 @@
3434
test_classes.extend(type(test) for test in suit)
3535
test_classes = sorted(set(test_classes), key=lambda cls: cls.__qualname__)
3636
for cls in test_classes:
37-
cls.__name__ += suffix
38-
cls.__qualname__ += suffix
37+
cls.__name__ = name + suffix
3938
@classmethod
4039
def setUpClass(cls_, module=module):
4140
cls_._save_sys_modules = sys.modules.copy()
@@ -48,10 +47,9 @@ def tearDownClass(cls_):
4847
sys.modules.update(cls_._save_sys_modules)
4948
cls.setUpClass = setUpClass
5049
cls.tearDownClass = tearDownClass
51-
all_test_classes.extend(test_classes)
5250

5351
def test_main():
54-
run_unittest(*all_test_classes)
52+
run_unittest(*test_classes)
5553

5654
if __name__ == "__main__":
5755
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)