Opened 9 years ago
Closed 9 years ago
#27012 closed Bug (fixed)
test_nested_requests wipes out pre-test settings
| Reported by: | Chris Jerdonek | Owned by: | Chris Jerdonek |
|---|---|---|---|
| Component: | Testing framework | Version: | dev |
| 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 (last modified by )
I noticed that nested_view() calls setup_test_environment() (direct link):
def nested_view(request): setup_test_environment() c = Client() c.get("/no_template_view/") return render(request, 'base.html', {'nested': 'yes'})
This function is used in the test: test_client_regress.tests.ContextTests.test_nested_requests.
This causes pre-test setting values like _original_email_backend and _original_allowed_hosts to be wiped out because these values are overwritten by the test values when setup_test_environment() is called a second time (see here for setup_test_environment()).
Change History (5)
comment:1 by , 9 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 9 years ago
| Has patch: | set |
|---|
comment:4 by , 9 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|---|
| Version: | 1.9 → master |
Agreed, that could be the source of subtle bugs.
Note:
See TracTickets
for help on using tickets.
I added a pull request for this here.