Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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)

0001-Don-t-try-to-tear-down-aliases-for-test-databases-it.patch (638 bytes ) - added by Simon Percivall 11 years ago.
0002-Don-t-try-to-tear-down-aliases-for-test-databases-it.patch (2.6 KB ) - added by Simon Percivall 11 years ago.
patch with test case
dont-try-to-tear-down-test-database-aliases.patch (2.6 KB ) - added by anonymous 11 years ago.
patch against master

Download all attachments as: .zip

Change History (13)

comment:1 by Simon Percivall, 11 years ago

Cc: percivall@… added

comment:2 by Baptiste Mispelon, 11 years ago

Has patch: set
Needs tests: set

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

comment:3 by Shai Berger, 11 years ago

Hi,

I suspect this is either a duplicate or a regression of #14415 (the description is too terse to tell, esp. with no test case). Also, #19542 (Oracle specific) may be related.

comment:4 by Aymeric Augustin, 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 Simon Percivall, 11 years ago

patch with test case

comment:5 by Simon Percivall, 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 Tim Graham, 11 years ago

Needs tests: unset
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Looks good Simon, could you provide a patch against master? Also please use assertEqual rather than assertEquals.

by anonymous, 11 years ago

patch against master

comment:7 by Simon Percivall, 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 Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In d9c580306c4b7da49d7fd2fd1ea0e6333a784113:

Fixed #20681 -- Prevented teardown_databases from attempting to tear down aliases

Thanks simonpercivall.

comment:9 by Tim Graham <timograham@…>, 11 years ago

In e5241902f3d4b0f925eb67809dfb732dd46ba597:

[1.6.x] Fixed #20681 -- Prevented teardown_databases from attempting to tear down aliases

Thanks simonpercivall.

Backport of d9c580306c from master

comment:10 by Tim Graham <timograham@…>, 11 years ago

In 8904e9fb98eaa94fd38e28706e2fe6786d3adc70:

[1.5.x] Fixed #20681 -- Prevented teardown_databases from attempting to tear down aliases

Thanks simonpercivall.

Backport of d9c580306c from master

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