Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#15016 closed (fixed)

Minor contrib.messages test isolation problem

Reported by: Gabriel Hurley Owned by: Gabriel Hurley
Component: Contrib apps Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When running manage.py test on a project with django.contrib.messages in INSTALLED_APPS, if you have a customized 500.html template which uses the {% url %} tag to try and resolve any namespaced urls you'll get errors from the test_middleware_disabled_anon_user test for each of the message backend test classes. Since the base test class overrides the project urls, any custom url namespaces are unresolvable when the test intentionally triggers a server error, causing the test to error out.

Basically the test just needs better isolation from the rest of the project.

Attachments (1)

15016_messages_test_isolation.diff (1.0 KB ) - added by Gabriel Hurley 14 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

contrib.auth.tests.views.AuthViewsTestCase contains an example of how to do this -- override TEMPLATE_DIRS as part of the test setUp/tearDown.

by Gabriel Hurley, 14 years ago

comment:2 by Gabriel Hurley, 14 years ago

Has patch: set
Status: newassigned

Added a very simple patch that fixes the four test failures seen under the described conditions.

comment:3 by Paul McMillan, 14 years ago

Triage Stage: AcceptedReady for checkin

Looks good (and works) for me. Marking as RFC.

comment:4 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: assignedclosed

In [15407]:

Fixed #15016 -- Ensured that the messages tests are isolated from local template directories. Thanks to Gabriel Hurley for the report and patch.

comment:5 by Russell Keith-Magee, 14 years ago

In [15408]:

[1.2.X] Fixed #15016 -- Ensured that the messages tests are isolated from local template directories. Thanks to Gabriel Hurley for the report and patch.

Backport of r15407 from trunk.

comment:6 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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