#21165 closed Bug (fixed)
regressiontests.syndication.tests.SyndicationFeedTest.test_feed_last_modified_time fails on Windows with sqlite
Reported by: | Michael Manfre | Owned by: | nobody |
---|---|---|---|
Component: | contrib.syndication | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Claude Paroz | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
(django) C:\projects\django\django>python tests\runtests.py --settings=test_sqlite syndication.SyndicationFeedTest Creating test database for alias 'default'... Creating test database for alias 'other'... ....F........ ====================================================================== FAIL: test_feed_last_modified_time (regressiontests.syndication.tests.SyndicationFeedTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\projects\django\django\tests\regressiontests\syndication\tests.py", line 231, in test_feed_last_modified_time self.assertEqual(response['Last-Modified'], 'Thu, 03 Jan 2008 19:30:00 GMT') AssertionError: 'Thu, 03 Jan 2008 18:30:00 GMT' != u'Thu, 03 Jan 2008 19:30:00 GMT' ---------------------------------------------------------------------- Ran 13 tests in 0.206s FAILED (failures=1) Destroying test database for alias 'default'... Destroying test database for alias 'other'...
Test was added with 08d675a98f1ae1d27f7e1946125ed5316c576802, which is the first failure.
08d675a98f1ae1d27f7e1946125ed5316c576802 is the first bad commit commit 08d675a98f1ae1d27f7e1946125ed5316c576802 Author: Claude Paroz <claude@2xlibre.net> Date: Sun Sep 30 20:44:27 2012 +0200 Fixed #7936 -- Added Last-Modified header to feeds Thanks julianb for the report and the initial patch, and Roman Gladkov for working on tests. :040000 040000 b758f8d1ae8118a97236121022e9837a9d84c482 48f931faa97115278e580cfe2c1a19341edd5bf1 M django :040000 040000 ae5b21c9a1afb9dbb5376f309cbd9b029543f767 1451b9d60d4f856e0fdd33579b779363d959a083 M tests
Attachments (1)
Change History (10)
comment:1 by , 11 years ago
by , 11 years ago
Attachment: | fix_ticket_21165_syndication_last_modifed.patch added |
---|
Patch to fix the tests on Windows
comment:2 by , 11 years ago
Has patch: | set |
---|
comment:3 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
I'd prefer to import requires_tz_support
rather than duplicate its definition. Otherwise this patch looks good.
comment:6 by , 11 years ago
Patch needs improvement: | set |
---|
xelnor, could you update the patch (accessorily, the new test fails on my system...)?
comment:7 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:9 by , 11 years ago
I'm seeing similar failures in Windows in utils_tests.test_dateformat.DateFormatTests
. Same issue?
====================================================================== FAIL: test_datetime_with_local_tzinfo (utils_tests.test_dateformat.DateFormatTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Django\django\tests\utils_tests\test_dateformat.py", line 39, in test_datetime_with_local_tzinfo self.assertEqual(datetime.fromtimestamp(int(format(dt, 'U'))), dt.replace(tzinfo=None)) AssertionError: datetime.datetime(2009, 5, 16, 4, 30, 30) != datetime.datetime(2009, 5, 16, 5, 30, 30) ====================================================================== FAIL: test_datetime_with_tzinfo (utils_tests.test_dateformat.DateFormatTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Django\django\tests\utils_tests\test_dateformat.py", line 48, in test_datetime_with_tzinfo self.assertEqual(datetime.fromtimestamp(int(format(dt, 'U'))), dt.astimezone(ltz).replace(tzinfo=None)) AssertionError: datetime.datetime(2009, 5, 16, 4, 30, 30) != datetime.datetime(2009, 5, 16, 5, 30, 30)
Note:
See TracTickets
for help on using tickets.
The failure on Windows comes from the lack of handling of non-system timezones.
This is documented in the note on https://docs.djangoproject.com/en/1.6/ref/settings/#time-zone ; if the Windows system timezone is set to
America/Chicago
, the test passes.Since this test doesn't try to check the naive to aware conversion of dates for the
Last-Modified
header, I propose a patch that:1) Uses the "timezone-aware" example feed, thus passing on Windows
2) Adds an extra test to check that the
Last-Modified
header is set correctly for timezone-naive feeds; that test is skipped on Windows, just like similar tests intests/timezones/tests.py
.