#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)
Change History (5)
by , 15 years ago
Attachment: | previous-month-11696.diff added |
---|
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 15 years ago
comment:4 by , 15 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).
Patch against trunk, rev11696