[1.8.x] Improved isolation of applied-migrations table in migration tests.
Backport of 335fc44f68
from master.
This commit is contained in:
parent
de62c77460
commit
c37c6dc410
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.db.migrations.recorder import MigrationRecorder
|
||||||
from django.test import TransactionTestCase
|
from django.test import TransactionTestCase
|
||||||
from django.utils._os import upath
|
from django.utils._os import upath
|
||||||
|
|
||||||
|
@ -13,6 +14,11 @@ class MigrationTestBase(TransactionTestCase):
|
||||||
available_apps = ["migrations"]
|
available_apps = ["migrations"]
|
||||||
test_dir = os.path.abspath(os.path.dirname(upath(__file__)))
|
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):
|
def get_table_description(self, table):
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
return connection.introspection.get_table_description(cursor, table)
|
return connection.introspection.get_table_description(cursor, table)
|
||||||
|
|
Loading…
Reference in New Issue