summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-11-14 08:54:30 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2015-11-14 08:54:30 (GMT)
commit63c1ebb67b4716720ad6e807d8f6a19042af83eb (patch)
tree33d82d95ebc75e62f1796fac4d585caae12a56f3 /Lib/test/datetimetester.py
parent449e7c1b06c6d6cafd515d87e91e12e1407e59c9 (diff)
downloadcpython-63c1ebb67b4716720ad6e807d8f6a19042af83eb.zip
cpython-63c1ebb67b4716720ad6e807d8f6a19042af83eb.tar.gz
cpython-63c1ebb67b4716720ad6e807d8f6a19042af83eb.tar.bz2
Issue #25168: Temporary timezone and cache debugging
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 11deffc..332d94b 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -1979,7 +1979,16 @@ class TestDateTime(TestDate):
seconds = tzseconds
hours, minutes = divmod(seconds//60, 60)
dtstr = "{}{:02d}{:02d} {}".format(sign, hours, minutes, tzname)
- dt = strptime(dtstr, "%z %Z")
+ try:
+ dt = strptime(dtstr, "%z %Z")
+ except ValueError:
+ import os
+ self.fail(
+ "Issue #25168 strptime() failure info:\n"
+ f"_TimeRE_cache['Z']={_strptime._TimeRE_cache['Z']!r}\n"
+ f"TZ={os.environ.get('TZ')!r}, or {os.getenv('TZ')!r} via getenv()\n"
+ f"_regex_cache={_strptime._regex_cache!r}\n"
+ )
self.assertEqual(dt.utcoffset(), timedelta(seconds=tzseconds))
self.assertEqual(dt.tzname(), tzname)
# Can produce inconsistent datetime