Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#12125 closed (fixed)

[patch] The tests for date-based generic views fail in november

Reported by: Bruno Renié Owned by: nobody
Component: Generic views Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In tests/regressiontests/views/tests/generic/date_based.py, line 103:

There is a typo in the prev_month calculation: if the current month is November, then it gets back to the previous year, which should happen in January and not in November.

This behavior makes the test suite fail in November. See the attached trivial patch.

Attachments (1)

previous-month-11696.diff (718 bytes ) - added by Bruno Renié 14 years ago.
Patch against trunk, rev11696

Download all attachments as: .zip

Change History (5)

by Bruno Renié, 14 years ago

Attachment: previous-month-11696.diff added

Patch against trunk, rev11696

comment:1 by Karen Tracey, 14 years ago

Triage Stage: UnreviewedAccepted

Hah. That's been there since April.

comment:2 by Karen Tracey, 14 years ago

Resolution: fixed
Status: newclosed

(In [11697]) Fixed #12125 -- Fixed a typo in the generic views date_based test that caused it to fail in November. Thanks brutasse.
--This line and those below, will be ignored--

M tests/regressiontests/views/tests/generic/date_based.py

comment:3 by Karen Tracey, 14 years ago

(In [11698]) [1.1.X] (In [11697]) Fixed #12125 -- Fixed a typo in the generic views date_based test that caused it to fail in November. Thanks brutasse.

r11697 from trunk.

comment:4 by Tamas Szabo, 14 years ago

I've just got this bug myself while running the Django tests, but checked if it's fixed before I raised a bug and found out that it was :)

I don't think that test is very well written.

You should have tests at the boundaries of years with the setUp and assertions values hard-coded (ex. 2004/01/01, 2003/12/01).
I don't see what the value is in a setUp value that changes and then you have to calculate your assertions based on that.
IMHO, it would be better to be able to have fixed the inputs and therefore fixed expectations that you can consistently run without being affected by external factors (like system time).

Note: See TracTickets for help on using tickets.
Back to Top