From 1ba89ddd09158c0f079b44bc503b2e80136de695 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Tue, 9 Feb 2021 19:47:50 +0100 Subject: [PATCH] refactor migration tests to allow testing for exceptions while migrating --- src/documents/tests/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/documents/tests/utils.py b/src/documents/tests/utils.py index b9be25d70..da8d3d429 100644 --- a/src/documents/tests/utils.py +++ b/src/documents/tests/utils.py @@ -92,6 +92,7 @@ class TestMigrations(TransactionTestCase): migrate_from = None migrate_to = None + auto_migrate = True def setUp(self): super(TestMigrations, self).setUp() @@ -108,6 +109,12 @@ class TestMigrations(TransactionTestCase): self.setUpBeforeMigration(old_apps) + self.apps = old_apps + + if self.auto_migrate: + self.performMigration() + + def performMigration(self): # Run the migration to test executor = MigrationExecutor(connection) executor.loader.build_graph() # reload.