#25745 closed Bug (fixed)
Fix RuntimeWarnings about model reloading in test suite
Reported by: | Tim Graham | Owned by: | Simon Charette |
---|---|---|---|
Component: | Core (Other) | 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
Similar warnings to those reported in #24812 are back in several apps: order_with_respect_to
, foreign_object
, schema
.
To see the order_with_respect_to
warnings, you must also include contenttypes_tests
(these apps share models):
$ python -Wall runtests.py order_with_respect_to contenttypes_tests
Example:
/home/tim/code/django/django/db/models/base.py:283: RuntimeWarning: Model 'order_with_respect_to.bar' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
We should probably promote RuntimeWarning
to "error" in tests/runtests.py
to prevent future regressions.
Change History (20)
comment:1 by , 9 years ago
comment:3 by , 9 years ago
The schema
tests will need a bit of adjustment to avoid registering the LocalTagThrough
model multiple time to the same apps
instance (see SchemaTests._test_m2m_create_through
).
comment:4 by , 9 years ago
Tim what do you think of closing this ticket in favor of #25746?
Maybe we should reuse this one for the sole purpose of promoting RuntimeWarning
to errors?
comment:5 by , 9 years ago
I'd appreciate (perhaps simpler) patches we could backport to 1.9 and 1.8 (schema only).
comment:6 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I wonder if the
order_with_respect_to
andforeign_object
issues are fixed by the following commits:https://github.com/charettes/django/commit/836c19a2b64e8324fa792104fddb434e29be125c
https://github.com/charettes/django/commit/8eb98a0809229e635d1603c19314ac4c383d9ead
which are part of this PR.