Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #2099 -- Allow timezone tests to be ignored on Windows systems,…

… due to

lack of time.tzset(). Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 875e7cb8154dc7ae4151f23b48a81113cde7a203 1 parent f5b1da1
@malcolmt malcolmt authored
Showing with 23 additions and 19 deletions.
  1. +23 −19 tests/regressiontests/dateformat/tests.py
View
42 tests/regressiontests/dateformat/tests.py
@@ -21,22 +21,22 @@
'7'
>>> format(my_birthday, 'N')
'July'
->>> format(my_birthday, 'O')
-'+0100'
+>>> no_tz or format(my_birthday, 'O') == '+0100'
+True
>>> format(my_birthday, 'P')
'10 p.m.'
->>> format(my_birthday, 'r')
-'Sun, 8 Jul 1979 22:00:00 +0100'
+>>> no_tz or format(my_birthday, 'r') == 'Sun, 8 Jul 1979 22:00:00 +0100'
+True
>>> format(my_birthday, 's')
'00'
>>> format(my_birthday, 'S')
'th'
>>> format(my_birthday, 't')
'31'
->>> format(my_birthday, 'T')
-'CET'
->>> format(my_birthday, 'U')
-'300531600'
+>>> no_tz or format(my_birthday, 'T') == 'CET'
+True
+>>> no_tz or format(my_birthday, 'U') == '300531600'
+True
>>> format(my_birthday, 'w')
'0'
>>> format(my_birthday, 'W')
@@ -47,17 +47,17 @@
'1979'
>>> format(my_birthday, 'z')
'189'
->>> format(my_birthday, 'Z')
-'3600'
+>>> no_tz or format(my_birthday, 'Z') == '3600'
+True
->>> format(summertime, 'I')
-'1'
->>> format(summertime, 'O')
-'+0200'
->>> format(wintertime, 'I')
-'0'
->>> format(wintertime, 'O')
-'+0100'
+>>> no_tz or format(summertime, 'I') == '1'
+True
+>>> no_tz or format(summertime, 'O') == '+0200'
+True
+>>> no_tz or format(wintertime, 'I') == '0'
+True
+>>> no_tz or format(wintertime, 'O') == '+0100'
+True
>>> format(my_birthday, r'Y z \C\E\T')
'1979 189 CET'
@@ -73,7 +73,11 @@
os.environ['TZ'] = 'Europe/Copenhagen'
translation.activate('en-us')
-time.tzset()
+try:
+ time.tzset()
+ no_tz = False
+except AttributeError:
+ no_tz = True
my_birthday = datetime.datetime(1979, 7, 8, 22, 00)
summertime = datetime.datetime(2005, 10, 30, 1, 00)

0 comments on commit 875e7cb

Please sign in to comment.
Something went wrong with that request. Please try again.