Opened 14 years ago

Closed 11 years ago

#2099 closed defect (fixed)

dateformat test fails on Windows (Python 2.4.2)

Reported by: a.lebedev@… Owned by: Adrian Holovaty
Component: Testing framework Version: master
Severity: normal Keywords: windows timezone
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When trying to run unit test suite against sqlite3 database you get one test failing:

D:\doc\study\django\alex>d:\django\tests\runtests  --settings=settings
Running tests with database 'sqlite3'

'dateformat' module: Error while importing
  File "d:\django\tests\", line 208, in run_tests
    mod = __import__("othertests." + module, '', '', [''])
  File "d:\django\tests\othertests\", line 76, in ?
AttributeError: 'module' object has no attribute 'tzset'

1 error:

Always reproduces. Using latest SVN (3091)

Pyhton 2.4.2
Windows XP SP2

Attachments (1)

dateformat_win32.patch (1.8 KB) - added by Chris Beaven 13 years ago.
fix so windows users can still run test suite

Download all attachments as: .zip

Change History (8)

comment:1 Changed 14 years ago by Chris Beaven

Just to be clear, it's not a database problem, it's the fact that .tzset() is only available in unix.

comment:2 Changed 14 years ago by Chris Beaven

... and from my research, it's not coming to Win32 any time soon. I'm not sure what the solution is here. Perhaps just ignoring Win32 and splitting all the timezone dependant tests to a seperate module that only runs if tzset is available?

pytz - World Time Definitions for Python is a great library for using proper tzinfo objects rather than just changing the local timezone for Python, but I doubt Django developers want any more dependancies.

comment:3 Changed 14 years ago by asmodai@…

Given this thread I doubt you will get any decent tzset() working natively by Python.

Stuart Bishop, the guy of the pytz package, is actually one of the participants of that tzset() discussion.

Even on POSIX things are not standardised when it comes to the environment variable TZ.

Changed 13 years ago by Chris Beaven

Attachment: dateformat_win32.patch added

fix so windows users can still run test suite

comment:4 Changed 13 years ago by Malcolm Tredinnick

This looks good, although the tests should be in the opposite order (no_tz or ...) so that short-circuiting mean we bail out even attempting the path that is known to fail. Slightly better programming practice that way (more efficient in other circumstances, too). Dont' worry about making another patch, though. I'll apply this later this morning and fix it then.

comment:5 Changed 13 years ago by mir@…

Has patch: set
Keywords: windows timezone added
Resolution: fixed
Status: newclosed

looks like this patch has already been applied.

comment:7 Changed 11 years ago by James Bennett

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.
Back to Top