MCPcopy
hub / github.com/django/django / test_loading_squashed

Method test_loading_squashed

tests/migrations/test_loader.py:292–308  ·  view source on GitHub ↗

Tests loading a squashed migration

(self)

Source from the content-addressed store, hash-verified

290 MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed"}
291 )
292 def test_loading_squashed(self):
293 "Tests loading a squashed migration"
294 migration_loader = MigrationLoader(connection)
295 recorder = MigrationRecorder(connection)
296 self.addCleanup(recorder.flush)
297 # Loading with nothing applied should just give us the one node
298 self.assertEqual(
299 len([x for x in migration_loader.graph.nodes if x[0] == "migrations"]),
300 1,
301 )
302 # However, fake-apply one migration and it should now use the old two
303 self.record_applied(recorder, "migrations", "0001_initial")
304 migration_loader.build_graph()
305 self.assertEqual(
306 len([x for x in migration_loader.graph.nodes if x[0] == "migrations"]),
307 2,
308 )
309
310 @override_settings(
311 MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed_complex"}

Callers

nothing calls this directly

Calls 4

record_appliedMethod · 0.95
build_graphMethod · 0.95
MigrationLoaderClass · 0.90
MigrationRecorderClass · 0.90

Tested by

no test coverage detected