diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-09-08 02:04:31 -0500 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-09-09 22:32:51 +0200 |
| commit | ec2778b445546f624d3b3a1f2118e751b10bb2e7 (patch) | |
| tree | 1ea949e943904505974c48e1219d5593528664c1 /tests | |
| parent | 9d700322b38ea670800a97f2b92dd2fc2c6ff28d (diff) | |
Fixed #17262 -- Refactored tzinfo implementations.
This commit deprecates django.utils.tzinfo in favor of the more recent
django.utils.timezone which was introduced when Django gained support
for time zones.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/timezones/tests.py | 5 | ||||
| -rw-r--r-- | tests/utils_tests/test_timezone.py | 5 | ||||
| -rw-r--r-- | tests/utils_tests/test_tzinfo.py | 10 |
3 files changed, 12 insertions, 8 deletions
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index 9390eb93df..e9d29f704b 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -25,7 +25,6 @@ from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from django.test.utils import override_settings from django.utils import six from django.utils import timezone -from django.utils.tzinfo import FixedOffset from .forms import EventForm, EventSplitForm, EventModelForm from .models import Event, MaybeEvent, Session, SessionEvent, Timestamp, AllDayEvent @@ -40,8 +39,8 @@ from .models import Event, MaybeEvent, Session, SessionEvent, Timestamp, AllDayE # 10:20:30 in UTC and 17:20:30 in ICT. UTC = timezone.utc -EAT = FixedOffset(180) # Africa/Nairobi -ICT = FixedOffset(420) # Asia/Bangkok +EAT = timezone.get_fixed_timezone(180) # Africa/Nairobi +ICT = timezone.get_fixed_timezone(420) # Asia/Bangkok TZ_SUPPORT = hasattr(time, 'tzset') diff --git a/tests/utils_tests/test_timezone.py b/tests/utils_tests/test_timezone.py index 6d5f9a7482..de80afe325 100644 --- a/tests/utils_tests/test_timezone.py +++ b/tests/utils_tests/test_timezone.py @@ -6,11 +6,10 @@ import unittest from django.test.utils import override_settings from django.utils import six from django.utils import timezone -from django.utils.tzinfo import FixedOffset -EAT = FixedOffset(180) # Africa/Nairobi -ICT = FixedOffset(420) # Asia/Bangkok +EAT = timezone.get_fixed_timezone(180) # Africa/Nairobi +ICT = timezone.get_fixed_timezone(420) # Asia/Bangkok class TimezoneTests(unittest.TestCase): diff --git a/tests/utils_tests/test_tzinfo.py b/tests/utils_tests/test_tzinfo.py index 1867743fef..31fd7c4a50 100644 --- a/tests/utils_tests/test_tzinfo.py +++ b/tests/utils_tests/test_tzinfo.py @@ -4,10 +4,16 @@ import os import pickle import time import unittest +import warnings -from django.utils.tzinfo import FixedOffset, LocalTimezone +from django.test.utils import IgnorePendingDeprecationWarningsMixin -class TzinfoTests(unittest.TestCase): +# Swallow the import-time warning to test the deprecated implementation. +with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=PendingDeprecationWarning) + from django.utils.tzinfo import FixedOffset, LocalTimezone + +class TzinfoTests(IgnorePendingDeprecationWarningsMixin, unittest.TestCase): @classmethod def setUpClass(cls): |
