mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #24812 -- Fixed app registry RuntimeWarnings in schema and migrations tests.
This commit is contained in:
parent
e4f0e5a981
commit
f5da438072
2 changed files with 19 additions and 3 deletions
|
@ -396,17 +396,22 @@ class StateTests(TestCase):
|
|||
#24573 - Adding relations to existing models should reload the
|
||||
referenced models too.
|
||||
"""
|
||||
new_apps = Apps()
|
||||
|
||||
class A(models.Model):
|
||||
class Meta:
|
||||
app_label = 'something'
|
||||
apps = new_apps
|
||||
|
||||
class B(A):
|
||||
class Meta:
|
||||
app_label = 'something'
|
||||
apps = new_apps
|
||||
|
||||
class C(models.Model):
|
||||
class Meta:
|
||||
app_label = 'something'
|
||||
apps = new_apps
|
||||
|
||||
project_state = ProjectState()
|
||||
project_state.add_model(ModelState.from_model(A))
|
||||
|
@ -447,15 +452,19 @@ class StateTests(TestCase):
|
|||
#24225 - Tests that relations between models are updated while
|
||||
remaining the relations and references for models of an old state.
|
||||
"""
|
||||
new_apps = Apps()
|
||||
|
||||
class A(models.Model):
|
||||
class Meta:
|
||||
app_label = "something"
|
||||
apps = new_apps
|
||||
|
||||
class B(models.Model):
|
||||
to_a = models.ForeignKey(A)
|
||||
|
||||
class Meta:
|
||||
app_label = "something"
|
||||
apps = new_apps
|
||||
|
||||
def get_model_a(state):
|
||||
return [mod for mod in state.apps.get_models() if mod._meta.model_name == 'a'][0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue