diff options
| author | Carl Meyer <carl@oddbird.net> | 2015-06-02 14:19:23 -0600 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2015-06-02 16:21:03 -0600 |
| commit | c37c6dc410cab2d66a651647015d919feaecc4f7 (patch) | |
| tree | 8d77e2fa049038322e1f5865850c31e343479870 | |
| parent | de62c77460b4fccab22d466753280b6bd92379d6 (diff) | |
[1.8.x] Improved isolation of applied-migrations table in migration tests.
Backport of 335fc44f6872f4678e48f65e91961ef19d6439b4 from master.
| -rw-r--r-- | tests/migrations/test_base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/migrations/test_base.py b/tests/migrations/test_base.py index 7b3e2a9fcd..c727785167 100644 --- a/tests/migrations/test_base.py +++ b/tests/migrations/test_base.py @@ -1,6 +1,7 @@ import os from django.db import connection +from django.db.migrations.recorder import MigrationRecorder from django.test import TransactionTestCase from django.utils._os import upath @@ -13,6 +14,11 @@ class MigrationTestBase(TransactionTestCase): available_apps = ["migrations"] test_dir = os.path.abspath(os.path.dirname(upath(__file__))) + def tearDown(self): + # Reset applied-migrations state. + recorder = MigrationRecorder(connection) + recorder.migration_qs.filter(app='migrations').delete() + def get_table_description(self, table): with connection.cursor() as cursor: return connection.introspection.get_table_description(cursor, table) |
