babel
babel copied to clipboard
test_get_timezone_name_misc fails when system TZ isn't UTC
Overview Description
While running tox tests I noticed two tests fails:
________________ test_get_timezone_name_misc[zoneinfo.ZoneInfo] ________________
timezone_getter = <class 'zoneinfo.ZoneInfo'>
def test_get_timezone_name_misc(timezone_getter):
localnow = datetime.utcnow().replace(tzinfo=timezone_getter('UTC')).astimezone(dates.LOCALTZ)
> assert (dates.get_timezone_name(None, locale='en_US') ==
dates.get_timezone_name(localnow, locale='en_US'))
E AssertionError: assert 'GMT+00:00' == 'GMT+01:00'
E - GMT+01:00
E ? ^
E + GMT+00:00
E ? ^
tests/test_dates.py:567: AssertionError
__________________ test_get_timezone_name_misc[pytz.timezone] __________________
timezone_getter = <function timezone at 0x7fffa9f578b0>
def test_get_timezone_name_misc(timezone_getter):
localnow = datetime.utcnow().replace(tzinfo=timezone_getter('UTC')).astimezone(dates.LOCALTZ)
> assert (dates.get_timezone_name(None, locale='en_US') ==
dates.get_timezone_name(localnow, locale='en_US'))
E AssertionError: assert 'GMT+00:00' == 'GMT+01:00'
E - GMT+01:00
E ? ^
E + GMT+00:00
E ? ^
tests/test_dates.py:567: AssertionError
Steps to Reproduce
tox --current-env --no-provision --recreate -e py39
Actual Results
Two tests fail.
Expected Results
All tests pass.
Reproducibility
Always.
Additional Information
OS: OpenIndiana Python version: 3.9.16
Which version/revision is this? Sounds a lot like #757 and related issues...
It is Babel 2.11.0.
I tried to test with TZ=UTC and all tests passed.
I'm getting this on 2.12.1 even with TZ=UTC. Any workarounds?