]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-113027: Fix test_variable_tzname in test_email (#113821)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 8 Jan 2024 22:33:53 +0000 (00:33 +0200)
committerGitHub <noreply@github.com>
Mon, 8 Jan 2024 22:33:53 +0000 (22:33 +0000)
Determine the support of the Kyiv timezone by checking the result of
astimezone() which uses the system tz database and not the one
populated by zoneinfo.

Lib/test/test_email/test_utils.py

index c9d973df0a2192a98259c6f49cedd8a9aa217cfb..0f1c3a84e61abd302c8e29018a855fdaad37a067 100644 (file)
@@ -143,12 +143,12 @@ class LocaltimeTests(unittest.TestCase):
         t2 = utils.localtime(t0.replace(tzinfo=None))
         self.assertEqual(t1, t2)
 
-    @unittest.skipUnless("Europe/Kyiv" in zoneinfo.available_timezones(),
-                         "Can't find a Kyiv timezone database")
     @test.support.run_with_tz('Europe/Kyiv')
     def test_variable_tzname(self):
         t0 = datetime.datetime(1984, 1, 1, tzinfo=datetime.timezone.utc)
         t1 = utils.localtime(t0)
+        if t1.tzname() == 'Europe':
+            self.skipTest("Can't find a Kyiv timezone database")
         self.assertEqual(t1.tzname(), 'MSK')
         t0 = datetime.datetime(1994, 1, 1, tzinfo=datetime.timezone.utc)
         t1 = utils.localtime(t0)