Commit 8dadb215 authored by Alexander Belopolsky's avatar Alexander Belopolsky

Issue 24773: Make zoneinfo tests more robust.

parent 1f7480a6
...@@ -4677,7 +4677,10 @@ class ZoneInfoTest(unittest.TestCase): ...@@ -4677,7 +4677,10 @@ class ZoneInfoTest(unittest.TestCase):
def setUp(self): def setUp(self):
if sys.platform == "win32": if sys.platform == "win32":
self.skipTest("Skipping zoneinfo tests on Windows") self.skipTest("Skipping zoneinfo tests on Windows")
try:
self.tz = ZoneInfo.fromname(self.zonename) self.tz = ZoneInfo.fromname(self.zonename)
except FileNotFoundError as err:
self.skipTest("Skipping %s: %s" % (self.zonename, err))
def assertEquivDatetimes(self, a, b): def assertEquivDatetimes(self, a, b):
self.assertEqual((a.replace(tzinfo=None), a.fold, id(a.tzinfo)), self.assertEqual((a.replace(tzinfo=None), a.fold, id(a.tzinfo)),
...@@ -4738,7 +4741,7 @@ class ZoneInfoTest(unittest.TestCase): ...@@ -4738,7 +4741,7 @@ class ZoneInfoTest(unittest.TestCase):
# civil time was generally not solar time in those years. # civil time was generally not solar time in those years.
self.zonename.startswith('right/')): self.zonename.startswith('right/')):
self.skipTest("Skipping %s" % self.zonename) self.skipTest("Skipping %s" % self.zonename)
tz = ZoneInfo.fromname(self.zonename) tz = self.tz
TZ = os.environ.get('TZ') TZ = os.environ.get('TZ')
os.environ['TZ'] = self.zonename os.environ['TZ'] = self.zonename
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment