Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24812 closed Bug (fixed)

RuntimeWarning in schema tests about reloading models

Reported by: Tim Graham Owned by: Tim Graham
Component: Migrations Version: 1.8
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 (last modified by Tim Graham)

Warning should be fixed or silenced.

$ python -Wall runtests.py schema

/home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
./home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
..../home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localauthorwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
.sss/home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localauthorwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
./home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
./home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
/home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_uniques.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
./home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_tags.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
/home/tim/code/django/django/db/models/base.py:279: RuntimeWarning: Model 'localbookwithm2m_uniques.schema' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)

There is also one warning on the stable/1.7.x branch.

Also:

$ python -Wall runtests.py migrations.test_state
/home/tim/code/django/tests/migrations/test_state.py:450: RuntimeWarning: Model 'a.something' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  class A(models.Model):
/home/tim/code/django/tests/migrations/test_state.py:454: RuntimeWarning: Model 'b.something' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  class B(models.Model):
....../home/tim/code/django/tests/migrations/test_state.py:497: RuntimeWarning: Model 'a.something' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
  class A(models.Model):

Change History (6)

comment:1 by Tim Graham, 9 years ago

Description: modified (diff)

comment:2 by Tim Graham, 9 years ago

Owner: changed from nobody to Tim Graham
Status: newassigned

comment:3 by Tim Graham, 9 years ago

Has patch: set

PR

Version 0, edited 9 years ago by Tim Graham (next)

comment:4 by Markus Holtermann, 9 years ago

Triage Stage: AcceptedReady for checkin

Patch looks sensible to me, given the tests pass and the runtime warning(s) is/are gone.

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

Resolution: fixed
Status: assignedclosed

In f5da438:

Fixed #24812 -- Fixed app registry RuntimeWarnings in schema and migrations tests.

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

In 3c0e03ef:

[1.8.x] Fixed #24812 -- Fixed app registry RuntimeWarnings in schema and migrations tests.

Backport of f5da4380723c93998a4f5a845b6f26fa51a2cfe1 from master

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