-
Notifications
You must be signed in to change notification settings - Fork 352
Closed
Description
With this test file:
import pytest
from django.utils.timezone import get_current_timezone
def test_europe(settings):
settings.TIME_ZONE = 'UTC'
assert settings.TIME_ZONE == 'UTC'
tz = get_current_timezone()
assert tz.__class__.__name__ == 'UTC'
def test_america(settings):
settings.TIME_ZONE = 'America/Lima'
assert settings.TIME_ZONE == 'America/Lima'
tz = get_current_timezone()
assert tz.__class__.__name__ == 'America/Lima'The first test succeeds, but the second test isn't able to change the timezone.
tests/test_utils.py .F
======================================================== FAILURES ========================================================
______________________________________________________ test_america ______________________________________________________
tests/test_utils.py:15: in test_america
> assert tz.__class__.__name__ == 'America/Lima'
E assert 'UTC' == 'America/Lima'
E - UTC
E + America/Lima
===================================== 1 failed, 1 passed, 1 skipped in 0.11 seconds ======================================
Same problem if I use the setattr workaround mentioned at #46 (comment).
Is this a scoping problem?
Metadata
Metadata
Assignees
Labels
No labels