[1.7.x] Fix additional test failures caused by migration pollution
This commit is contained in:
parent
35bdf87034
commit
16d037c4f0
|
@ -18,23 +18,23 @@ class RecorderTests(TestCase):
|
||||||
"""
|
"""
|
||||||
recorder = MigrationRecorder(connection)
|
recorder = MigrationRecorder(connection)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
recorder.applied_migrations(),
|
set((x, y) for (x, y) in recorder.applied_migrations() if x == "myapp"),
|
||||||
set(),
|
set(),
|
||||||
)
|
)
|
||||||
recorder.record_applied("myapp", "0432_ponies")
|
recorder.record_applied("myapp", "0432_ponies")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
recorder.applied_migrations(),
|
set((x, y) for (x, y) in recorder.applied_migrations() if x == "myapp"),
|
||||||
set([("myapp", "0432_ponies")]),
|
set([("myapp", "0432_ponies")]),
|
||||||
)
|
)
|
||||||
# That should not affect records of another database
|
# That should not affect records of another database
|
||||||
recorder_other = MigrationRecorder(connections['other'])
|
recorder_other = MigrationRecorder(connections['other'])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
recorder_other.applied_migrations(),
|
set((x, y) for (x, y) in recorder_other.applied_migrations() if x == "myapp"),
|
||||||
set(),
|
set(),
|
||||||
)
|
)
|
||||||
recorder.record_unapplied("myapp", "0432_ponies")
|
recorder.record_unapplied("myapp", "0432_ponies")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
recorder.applied_migrations(),
|
set((x, y) for (x, y) in recorder.applied_migrations() if x == "myapp"),
|
||||||
set(),
|
set(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -136,14 +136,14 @@ class LoaderTests(TestCase):
|
||||||
recorder = MigrationRecorder(connection)
|
recorder = MigrationRecorder(connection)
|
||||||
# Loading with nothing applied should just give us the one node
|
# Loading with nothing applied should just give us the one node
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
len(migration_loader.graph.nodes),
|
len([x for x in migration_loader.graph.nodes if x[0] == "migrations"]),
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
# However, fake-apply one migration and it should now use the old two
|
# However, fake-apply one migration and it should now use the old two
|
||||||
recorder.record_applied("migrations", "0001_initial")
|
recorder.record_applied("migrations", "0001_initial")
|
||||||
migration_loader.build_graph()
|
migration_loader.build_graph()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
len(migration_loader.graph.nodes),
|
len([x for x in migration_loader.graph.nodes if x[0] == "migrations"]),
|
||||||
2,
|
2,
|
||||||
)
|
)
|
||||||
recorder.flush()
|
recorder.flush()
|
||||||
|
|
Loading…
Reference in New Issue