summaryrefslogtreecommitdiff
path: root/tests/migrations/test_executor.py
diff options
context:
space:
mode:
authorEvan Grim <evan@mirgnave.com>2017-07-11 11:40:18 -0500
committerTim Graham <timograham@gmail.com>2017-08-10 19:21:14 -0400
commit7937cc16f5fafb33a53b9a9ff286229fcc5ba67f (patch)
tree27f5226e663b8f69efea01ee54a533b9c0e7161e /tests/migrations/test_executor.py
parent5893eaddf4c866c2cd3f53660a3ffaf4d9db5dfa (diff)
Fixed #28386 -- Made operations within non-atomic migrations honor the operation's atomic flag when migrating backwards.
Diffstat (limited to 'tests/migrations/test_executor.py')
-rw-r--r--tests/migrations/test_executor.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index d6cc802149..fdbc724faf 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -126,6 +126,14 @@ class ExecutorTests(MigrationTestBase):
migrations_apps = executor.loader.project_state(("migrations", "0001_initial")).apps
Editor = migrations_apps.get_model("migrations", "Editor")
self.assertFalse(Editor.objects.exists())
+ # Record previous migration as successful.
+ executor.migrate([("migrations", "0001_initial")], fake=True)
+ # Rebuild the graph to reflect the new DB state.
+ executor.loader.build_graph()
+ # Migrating backwards is also atomic.
+ with self.assertRaisesMessage(RuntimeError, "Abort migration"):
+ executor.migrate([("migrations", None)])
+ self.assertFalse(Editor.objects.exists())
@override_settings(MIGRATION_MODULES={
"migrations": "migrations.test_migrations",