mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	refactor migration tests to allow testing for exceptions while migrating
This commit is contained in:
		| @@ -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. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler