MCPcopy
hub / github.com/django/django / test_load_unmigrated_dependency

Method test_load_unmigrated_dependency

tests/migrations/test_loader.py:143–164  ·  view source on GitHub ↗

The loader can load migrations with a dependency on an unmigrated app.

(self)

Source from the content-addressed store, hash-verified

141 MIGRATION_MODULES={"migrations": "migrations.test_migrations_unmigdep"}
142 )
143 def test_load_unmigrated_dependency(self):
144 """
145 The loader can load migrations with a dependency on an unmigrated app.
146 """
147 # Load and test the plan
148 migration_loader = MigrationLoader(connection)
149 self.assertEqual(
150 migration_loader.graph.forwards_plan(("migrations", "0001_initial")),
151 [
152 ("contenttypes", "0001_initial"),
153 ("auth", "0001_initial"),
154 ("migrations", "0001_initial"),
155 ],
156 )
157 # Now render it out!
158 project_state = migration_loader.project_state(("migrations", "0001_initial"))
159 self.assertEqual(
160 len([m for a, m in project_state.models if a == "migrations"]), 1
161 )
162
163 book_state = project_state.models["migrations", "book"]
164 self.assertEqual(list(book_state.fields), ["id", "user"])
165
166 @override_settings(
167 MIGRATION_MODULES={"migrations": "migrations.test_migrations_run_before"}

Callers

nothing calls this directly

Calls 3

project_stateMethod · 0.95
MigrationLoaderClass · 0.90
forwards_planMethod · 0.80

Tested by

no test coverage detected