mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 16:25:33 +01:00
refactor migration tests to allow testing for exceptions while migrating
This commit is contained in:
parent
0c40a28ad3
commit
1ba89ddd09
1 changed files with 7 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ class TestMigrations(TransactionTestCase):
|
||||||
|
|
||||||
migrate_from = None
|
migrate_from = None
|
||||||
migrate_to = None
|
migrate_to = None
|
||||||
|
auto_migrate = True
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestMigrations, self).setUp()
|
super(TestMigrations, self).setUp()
|
||||||
|
|
@ -108,6 +109,12 @@ class TestMigrations(TransactionTestCase):
|
||||||
|
|
||||||
self.setUpBeforeMigration(old_apps)
|
self.setUpBeforeMigration(old_apps)
|
||||||
|
|
||||||
|
self.apps = old_apps
|
||||||
|
|
||||||
|
if self.auto_migrate:
|
||||||
|
self.performMigration()
|
||||||
|
|
||||||
|
def performMigration(self):
|
||||||
# Run the migration to test
|
# Run the migration to test
|
||||||
executor = MigrationExecutor(connection)
|
executor = MigrationExecutor(connection)
|
||||||
executor.loader.build_graph() # reload.
|
executor.loader.build_graph() # reload.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue