initial_data fixtures using natural keys fail in tests with multiple databases
|Reported by:||dcramer||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If a fixture using natural keys is referenced before that database is created (in tests), then the fixture fails to load due to a "table does not exist" error (though may also throw database does not exist, since it may not have been created yet).
The reason for this is that objects are instantiated before they are actually created in the database, but they mapper only does this if they're not using natural keys. In the case where they are, it attempts to look them up from the database, rather than the existing in-memory instances.
Change History (4)
comment:1 Changed 5 years ago by dcramer
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 5 years ago by russellm
- Component changed from Uncategorized to Testing framework
- Resolution set to invalid
- Status changed from new to closed
- Triage Stage changed from Unreviewed to Accepted