Issue 24773: Make zoneinfo tests more robust.

This commit is contained in:
Alexander Belopolsky 2016-07-23 11:16:56 -04:00
parent 1f7480a67e
commit 8dadb2155b
1 changed files with 5 additions and 2 deletions

View File

@ -4677,7 +4677,10 @@ class ZoneInfoTest(unittest.TestCase):
def setUp(self):
if sys.platform == "win32":
self.skipTest("Skipping zoneinfo tests on Windows")
self.tz = ZoneInfo.fromname(self.zonename)
try:
self.tz = ZoneInfo.fromname(self.zonename)
except FileNotFoundError as err:
self.skipTest("Skipping %s: %s" % (self.zonename, err))
def assertEquivDatetimes(self, a, b):
self.assertEqual((a.replace(tzinfo=None), a.fold, id(a.tzinfo)),
@ -4738,7 +4741,7 @@ class ZoneInfoTest(unittest.TestCase):
# civil time was generally not solar time in those years.
self.zonename.startswith('right/')):
self.skipTest("Skipping %s" % self.zonename)
tz = ZoneInfo.fromname(self.zonename)
tz = self.tz
TZ = os.environ.get('TZ')
os.environ['TZ'] = self.zonename
try: