summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-05-29 21:54:47 (GMT)
committerGitHub <noreply@github.com>2024-05-29 21:54:47 (GMT)
commitaf57832e634720a797a54973a85d15ac3e13cf60 (patch)
tree65dfe86dc4bfaafeda2a6bb9cc22b01d0d4a6f74 /Lib
parenta7aa7c41ebfce5bf537c939c8dfc0605adcfabd8 (diff)
downloadcpython-af57832e634720a797a54973a85d15ac3e13cf60.zip
cpython-af57832e634720a797a54973a85d15ac3e13cf60.tar.gz
cpython-af57832e634720a797a54973a85d15ac3e13cf60.tar.bz2
[3.13] gh-117398: Add multiphase support to _datetime (gh-119694)
This is an unrevert of d58ebf0 (gh-119636), which was reverted by 9216a53 (gh-119639) due to problems which have been resolved. This is minimal support for multiphase init. Subinterpreters are not supported yet. That will be addressed in a later change. (cherry picked from commit 3e8b609) Co-authored-by: Erlend E. Aasland erlend@python.org
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/datetimetester.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index b3838d5..db6502b 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -47,6 +47,25 @@ except ImportError:
pass
#
+# This is copied from test_import/__init__.py.
+def no_rerun(reason):
+ """Skip rerunning for a particular test.
+
+ WARNING: Use this decorator with care; skipping rerunning makes it
+ impossible to find reference leaks. Provide a clear reason for skipping the
+ test using the 'reason' parameter.
+ """
+ def deco(func):
+ _has_run = False
+ def wrapper(self):
+ nonlocal _has_run
+ if _has_run:
+ self.skipTest(reason)
+ func(self)
+ _has_run = True
+ return wrapper
+ return deco
+
pickle_loads = {pickle.loads, pickle._loads}
pickle_choices = [(pickle, pickle, proto)
@@ -6383,6 +6402,7 @@ 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