MCPcopy
hub / github.com/django/django / test_migrate_record_replaced

Method test_migrate_record_replaced

tests/migrations/test_commands.py:1318–1336  ·  view source on GitHub ↗

Running a single squashed migration should record all of the original replaced migrations as run.

(self)

Source from the content-addressed store, hash-verified

1316 MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed"}
1317 )
1318 def test_migrate_record_replaced(self):
1319 """
1320 Running a single squashed migration should record all of the original
1321 replaced migrations as run.
1322 """
1323 recorder = MigrationRecorder(connection)
1324 out = io.StringIO()
1325 call_command("migrate", "migrations", verbosity=0)
1326 call_command("showmigrations", "migrations", stdout=out, no_color=True)
1327 self.assertEqual(
1328 "migrations\n [x] 0001_squashed_0002 (2 squashed migrations)\n",
1329 out.getvalue().lower(),
1330 )
1331 applied_migrations = recorder.applied_migrations()
1332 self.assertIn(("migrations", "0001_initial"), applied_migrations)
1333 self.assertIn(("migrations", "0002_second"), applied_migrations)
1334 self.assertIn(("migrations", "0001_squashed_0002"), applied_migrations)
1335 # Rollback changes
1336 call_command("migrate", "migrations", "zero", verbosity=0)
1337
1338 @override_settings(
1339 MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed"}

Callers

nothing calls this directly

Calls 4

applied_migrationsMethod · 0.95
MigrationRecorderClass · 0.90
call_commandFunction · 0.90
getvalueMethod · 0.45

Tested by

no test coverage detected