babel icon indicating copy to clipboard operation
babel copied to clipboard

test_get_timezone_name_misc fails when system TZ isn't UTC

Open mtelka opened this issue 3 years ago • 4 comments

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

mtelka avatar Dec 13 '22 17:12 mtelka

Which version/revision is this? Sounds a lot like #757 and related issues...

akx avatar Dec 13 '22 21:12 akx

It is Babel 2.11.0.

mtelka avatar Dec 13 '22 22:12 mtelka

I tried to test with TZ=UTC and all tests passed.

mtelka avatar Dec 27 '22 23:12 mtelka

I'm getting this on 2.12.1 even with TZ=UTC. Any workarounds?

s1341 avatar Mar 19 '23 12:03 s1341