Skip to content

Commit 652d3f3

Browse files
[3.11] gh-109017: Use non alternate name for Kyiv (GH-109251) (GH-111279)
tzdata provides Kiev as an alternative to Kyiv: https://sources.debian.org/src/tzdata/2023c-10/backward/?hl=314GH-L314 But Debian moved it to the tzdata-legacy package breaking the test: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050530 This patch switches to the name provided by tzdata. Also check that the new name is actually available. (cherry picked from commit 46407fe) Co-authored-by: Jochen Sprickerhof <github@jochen.sprickerhof.de>
1 parent ff7dc61 commit 652d3f3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Lib/test/test_email/test_utils.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import unittest
66
import sys
77
import os.path
8+
import zoneinfo
89

910
class DateTimeTests(unittest.TestCase):
1011

@@ -142,13 +143,9 @@ def test_localtime_epoch_notz_daylight_false(self):
142143
t2 = utils.localtime(t0.replace(tzinfo=None))
143144
self.assertEqual(t1, t2)
144145

145-
# XXX: Need a more robust test for Olson's tzdata
146-
@unittest.skipIf(sys.platform.startswith('win'),
147-
"Windows does not use Olson's TZ database")
148-
@unittest.skipUnless(os.path.exists('/usr/share/zoneinfo') or
149-
os.path.exists('/usr/lib/zoneinfo'),
150-
"Can't find the Olson's TZ database")
151-
@test.support.run_with_tz('Europe/Kiev')
146+
@unittest.skipUnless("Europe/Kyiv" in zoneinfo.available_timezones(),
147+
"Can't find a Kyiv timezone database")
148+
@test.support.run_with_tz('Europe/Kyiv')
152149
def test_variable_tzname(self):
153150
t0 = datetime.datetime(1984, 1, 1, tzinfo=datetime.timezone.utc)
154151
t1 = utils.localtime(t0)

0 commit comments

Comments
 (0)