diff options
| author | Paveł Tyślacki <pavel.tyslacki@gmail.com> | 2019-01-16 00:14:20 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-01-28 11:51:23 -0500 |
| commit | 62b8596616ea46849e29ca77a77e1196417dc1f9 (patch) | |
| tree | 93b152009e4d8dd299b51355f88a4a7f27cd1d44 /tests/migrations/test_multidb.py | |
| parent | 7785e03ba89aafbd949191f126361fb9103cb980 (diff) | |
Made test table cleanup in OperationTestBase more robust.
Some non-unique constraint names were added in
b69f8eb04cc8762d3dfd5af5ea1fc58e3f2ebcc3 which resulted in failures
depending on the order in which tests were run.
Diffstat (limited to 'tests/migrations/test_multidb.py')
| -rw-r--r-- | tests/migrations/test_multidb.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/migrations/test_multidb.py b/tests/migrations/test_multidb.py index b2c4320ad3..e0c5a4d3c5 100644 --- a/tests/migrations/test_multidb.py +++ b/tests/migrations/test_multidb.py @@ -122,13 +122,16 @@ class MultiDBOperationTests(OperationTestBase): self.assertEqual(Pony.objects.count(), 0) @override_settings(DATABASE_ROUTERS=[MigrateNothingRouter()]) - def test_run_sql(self): + def test_run_sql_migrate_nothing_router(self): self._test_run_sql("test_mltdb_runsql", should_run=False) @override_settings(DATABASE_ROUTERS=[MigrateWhenFooRouter()]) - def test_run_sql2(self): + def test_run_sql_migrate_foo_router_without_hints(self): self._test_run_sql("test_mltdb_runsql2", should_run=False) - self._test_run_sql("test_mltdb_runsql2", should_run=True, hints={'foo': True}) + + @override_settings(DATABASE_ROUTERS=[MigrateWhenFooRouter()]) + def test_run_sql_migrate_foo_router_with_hints(self): + self._test_run_sql('test_mltdb_runsql3', should_run=True, hints={'foo': True}) def _test_run_python(self, app_label, should_run, hints=None): with override_settings(DATABASE_ROUTERS=[MigrateEverythingRouter()]): @@ -156,10 +159,13 @@ class MultiDBOperationTests(OperationTestBase): self.assertEqual(Pony.objects.count(), 0) @override_settings(DATABASE_ROUTERS=[MigrateNothingRouter()]) - def test_run_python(self): + def test_run_python_migrate_nothing_router(self): self._test_run_python("test_mltdb_runpython", should_run=False) @override_settings(DATABASE_ROUTERS=[MigrateWhenFooRouter()]) - def test_run_python2(self): + def test_run_python_migrate_foo_router_without_hints(self): self._test_run_python("test_mltdb_runpython2", should_run=False) - self._test_run_python("test_mltdb_runpython2", should_run=True, hints={'foo': True}) + + @override_settings(DATABASE_ROUTERS=[MigrateWhenFooRouter()]) + def test_run_python_migrate_foo_router_with_hints(self): + self._test_run_python('test_mltdb_runpython3', should_run=True, hints={'foo': True}) |
