From e049c88603b474ccc5dbe02a60760280b149ecd8 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 30 Apr 2014 15:11:29 -0700 Subject: [PATCH] Cleanup failing test w/contenttypes and remove useless graph load --- django/core/management/commands/makemigrations.py | 3 +-- tests/migrations/test_state.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index d9d7a05b6c..d8aada94da 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -53,8 +53,7 @@ class Command(BaseCommand): # Load the current graph state. Takes a connection, but it's not used # (makemigrations doesn't look at the database state). # Also make sure the graph is built without unmigrated apps shoehorned in. - loader = MigrationLoader(connections[DEFAULT_DB_ALIAS], load=False) - loader.build_graph() + loader = MigrationLoader(connections[DEFAULT_DB_ALIAS]) # Before anything else, see if there's conflicting apps and drop out # hard if there are any and they don't want to merge diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index e5cee5f6cd..afd2f8b8b9 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -361,7 +361,10 @@ class StateTests(TestCase): project_state = ProjectState(real_apps=["contenttypes"]) project_state.add_model_state(ModelState.from_model(TestModel)) rendered_state = project_state.render() - self.assertEqual(len(rendered_state.get_models()), 2) + self.assertEqual( + len([x for x in rendered_state.get_models() if x._meta.app_label == "migrations"]), + 1, + ) class ModelStateTests(TestCase):