#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)
Change History (7)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 14 years ago
Attachment: | 15016_messages_test_isolation.diff added |
---|
comment:2 by , 14 years ago
Has patch: | set |
---|---|
Status: | new → assigned |
Added a very simple patch that fixes the four test failures seen under the described conditions.
comment:3 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Looks good (and works) for me. Marking as RFC.
contrib.auth.tests.views.AuthViewsTestCase contains an example of how to do this -- override TEMPLATE_DIRS as part of the test setUp/tearDown.