Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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)

fix_ticket_21165_syndication_last_modifed.patch (2.2 KB ) - added by Raphaël Barrois 11 years ago.
Patch to fix the tests on Windows

Download all attachments as: .zip

Change History (10)

comment:1 by Raphaël Barrois, 11 years ago

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 in tests/timezones/tests.py.

by Raphaël Barrois, 11 years ago

Patch to fix the tests on Windows

comment:2 by Raphaël Barrois, 11 years ago

Has patch: set

comment:3 by Aymeric Augustin, 11 years ago

Triage Stage: UnreviewedAccepted

I'd prefer to import requires_tz_support rather than duplicate its definition. Otherwise this patch looks good.

comment:4 by Claude Paroz <claude@…>, 11 years ago

In c1c44b25062c3a793ac0d8416f369383a4a58cb4:

Factorized requires_tz_support decorator in test utils

Thanks Aymeric Augustin for the suggestion. Refs #21165.

comment:5 by Claude Paroz <claude@…>, 11 years ago

In 5b97b99a014443b255cf8ab0467864c5874027da:

[1.6.x] Factorized requires_tz_support decorator in test utils

Thanks Aymeric Augustin for the suggestion. Refs #21165.
Backport of c1c44b2506 from master.

comment:6 by Claude Paroz, 11 years ago

Patch needs improvement: set

xelnor, could you update the patch (accessorily, the new test fails on my system...)?

comment:7 by Ramiro Morales <cramm0@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 62dfd79f8b4a1f7e702809cc21ce262f19da0f5b:

Fixed #21165 -- Fix test for syndication feed timestamp field on Windows.

Thanks Michael Manfre for the report, Raphaël Barrois for the patch and
Claude Paroz, Aymeric Augustin for the reviews.

Refs #7936.

comment:8 by Ramiro Morales <ramiro@…>, 11 years ago

In 5252885494079cf28a337644a87e61b19340f09c:

[1.6.x] Fixed #21165 -- Fix test for syndication feed timestamp field on Windows.

Thanks Michael Manfre for the report, Raphaël Barrois for the patch and
Claude Paroz, Aymeric Augustin for the reviews.

Refs #7936

62dfd79f8b from master.

comment:9 by Kevin Christopher Henry, 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.
Back to Top