mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-08 17:17:14 +00:00
refactor migration tests to allow testing for exceptions while migrating
This commit is contained in:
1 parent
0c40a28ad3
commit
1ba89ddd09
1 file changed
+7
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user