Tests that alter ROOT_URLCONF should set DEBUG_PROPAGATE_EXCEPTION
|Reported by:||Andy McKay||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Contrib message unit tests check that certain requests pass or fail. They do this by setting up custom templates and overriding key parts such as ROOT_URLCONF. The tests except the templates to fail in a certain way.
However you might have a custom 500 page defined in your project. If you do then the request will try to render that 500 page. If that 500 page then depends upon urls defined in your site, they will fail.
An example of this hitting someone else: http://recursive-design.com/blog/2009/11/10/noreversematch-custom-registration-templates-break-django-unit-tests/
If a test is going to mess with base configuration like ROOT_URLCONF it shouldn't get into trying to render the nice 500 pages and the way to do that is to set DEBUG_PROPAGATE_EXCEPTION. Here's one I found in django.contrib.messages from Arecibo.
Change History (29)
comment:1 Changed 5 years ago by
|Component:||Testing framework → contrib.messages|
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|
comment:10 Changed 5 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Ready for checkin → Accepted|