#20681 closed Bug (fixed)
teardown_databases tries to tear down aliases, which fails
Reported by: | Simon Percivall | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | percivall@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
If you have an aliased database, the teardown code will fail when trying to tear it down.
The patch changes setup_databases to only add a (connection, db_name) to old_names if it's not already been added by an previous alias.
Attachments (3)
Change History (13)
by , 11 years ago
Attachment: | 0001-Don-t-try-to-tear-down-aliases-for-test-databases-it.patch added |
---|
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
Has patch: | set |
---|---|
Needs tests: | set |
comment:3 by , 11 years ago
comment:4 by , 11 years ago
Not sure if that's related, but I've seen a similar problem when running tests with DATABASES = {}
(in an app that doesn't have any models).
by , 11 years ago
Attachment: | 0002-Don-t-try-to-tear-down-aliases-for-test-databases-it.patch added |
---|
patch with test case
comment:5 by , 11 years ago
Added new patch (more correct, I think), with test case.
The test won't work until #19940 is fixed, though.
comment:6 by , 11 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
Looks good Simon, could you provide a patch against master? Also please use assertEqual
rather than assertEquals
.
by , 11 years ago
Attachment: | dont-try-to-tear-down-test-database-aliases.patch added |
---|
patch against master
comment:7 by , 11 years ago
Patch against master uploaded. Changed from assertEquals
to assertEqual
, and changed the name of the test to be more descriptive.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hi,
Could you add a test case to the patch [1]?
Test cases are required for a patch to get merged and in this case, it would also make it easier to confirm the existence of the issue.
Thanks.
[1] https://docs.djangoproject.com/en/1.5/internals/contributing/writing-code/submitting-patches/#patch-style