Skip to content

Commit

Permalink
Fixed #2099 -- Allow timezone tests to be ignored on Windows systems,…
Browse files Browse the repository at this point in the history
… 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
malcolmt committed Sep 26, 2006
1 parent f5b1da1 commit 875e7cb
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions tests/regressiontests/dateformat/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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'
Expand All @@ -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)
Expand Down

0 comments on commit 875e7cb

Please sign in to comment.