]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-119659: Get the datetime CAPI Tests Running Again (gh-120180)
authorEric Snow <ericsnowcurrently@gmail.com>
Fri, 7 Jun 2024 17:44:56 +0000 (13:44 -0400)
committerGitHub <noreply@github.com>
Fri, 7 Jun 2024 17:44:56 +0000 (11:44 -0600)
The tests were accidentally disabled by 2da0dc0, which didn't handle classes correctly.

I considered updating no_rerun() to support classes, but the way test_datetime.py works would have made things fairly messy.  Plus, it looks like the refleaks we had encountered before have been resolved.

Lib/test/datetimetester.py
Lib/test/support/__init__.py

index 3759504b02e5508b79feb566b6802b4f83abc082..b80da5697ef86509d02eed028a52e5ac4d1df8cf 100644 (file)
@@ -22,7 +22,7 @@ from operator import lt, le, gt, ge, eq, ne, truediv, floordiv, mod
 
 from test import support
 from test.support import is_resource_enabled, ALWAYS_EQ, LARGEST, SMALLEST
-from test.support import warnings_helper, no_rerun
+from test.support import warnings_helper
 
 import datetime as datetime_module
 from datetime import MINYEAR, MAXYEAR
@@ -6385,7 +6385,6 @@ class IranTest(ZoneInfoTest):
 
 
 @unittest.skipIf(_testcapi is None, 'need _testcapi module')
-@no_rerun("the encapsulated datetime C API does not support reloading")
 class CapiTest(unittest.TestCase):
     def setUp(self):
         # Since the C API is not present in the _Pure tests, skip all tests
index 4b320b494bb8dd4d000910fe48ccd0bde5d41b6e..9e6100d2b89d6e1951f6424b5ea11f2162b76ac5 100644 (file)
@@ -1197,6 +1197,7 @@ def no_rerun(reason):
     test using the 'reason' parameter.
     """
     def deco(func):
+        assert not isinstance(func, type), func
         _has_run = False
         def wrapper(self):
             nonlocal _has_run