Opened 4 years ago

Closed 4 years ago

#22572 closed Bug (fixed)

@override_settings(ROOT_URLCONF) doesn't clear urlresolvers._urlconfs.

Reported by: loic84 Owned by: nobody
Component: Testing framework Version: master
Severity: Normal 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

BaseHandler.get_response() sets urlresolvers._urlconfs through the set_urlconf() function; this normally happens for every request.

The test client calls get_response(), but since @override_settings(ROOT_URLCONF) doesn't clear it, further reverse outside of the test client may fail.

This only affects single tests with multiple override_settings because SimpleTestCase clears the urlconf between tests.

Change History (4)

comment:2 Changed 4 years ago by ANUBHAV JOSHI

I think the issue being raised is valid and the PR opened is good to go.

comment:3 Changed 4 years ago by Tim Graham

Triage Stage: UnreviewedReady for checkin

comment:4 Changed 4 years ago by Loic Bistuer <loic.bistuer@…>

Resolution: fixed
Status: newclosed

In 942556df2ffd3276dc127edd3cbb9d177095d882:

Fixed #22572 -- override_settings(ROOT_URLCONF) didn't clear urlresolvers._urlconfs.

Thanks Anubhav Joshi and Tim Graham for the reviews.

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