Opened 9 years ago

Last modified 6 years ago

#15063 new Bug

multi_db flag on TestCase causes invalid error reporting when loading fixtures

Reported by: David Cramer Owned by: nobody
Component: Testing framework Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When setting multi_db = True on a test case you may encounter aliases which do not allow synchronization with specific tables. Due to the behavior of the fixture loader, it sees that no objects were loaded for these specific aliases and prints an exception to stderr and runs a rollback command.

The chunk of code in reference is here

(For posterity, the 'if objects_in_fixture == 0:' error assumption is what causes this behavior)

Change History (5)

comment:1 Changed 9 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

You appear to be describing a situation where a test database can't synchronize all the tables it should have, and as a result, fixture loading fails.

For my money, that situation *should* raise errors.

I'm not sure I see how this is related to multi-db. Setting multi-db=True increases the number of databases that will be synchronized, but it doesn't change the way individual databases are synchronized. If you get this problem with multi-db, you should be able to reproduce it with a single database under the right conditions.

Closing invalid; if I've missed the point, feel free to reopen and provide more detail. For the record, you should also feel free to provide sufficient detail when you open a ticket in the first place :-)

comment:2 Changed 9 years ago by Russell Keith-Magee

Component: UncategorizedTesting framework
Resolution: invalid
Status: closedreopened
Triage Stage: UnreviewedAccepted

Following discussion with David on IRC:

The actual problem here is a fixture that contains many valid objects, being synchronized onto a database where none of the models for those objects exist. E.g., I have a fixture with 10 Author objects; the Author table isn't synchronized onto 'other', but I'm loading Author onto 'other'. There are 10 valid objects, but 0 "loaded" objects, which raises an error during test case fixture loading.

comment:3 Changed 8 years ago by anonymous

Severity: Normal
Type: Bug

comment:4 Changed 8 years ago by Ramiro Morales

Easy pickings: unset
Summary: multi_db flag on TestCase causes invalid error reportingmulti_db flag on TestCase causes invalid error reporting when loading fixtures
UI/UX: unset

comment:5 Changed 6 years ago by Aymeric Augustin

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