From ecece1b22e35865cee429e239bcdd19f01925c9d Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 7 Dec 2018 19:55:47 -0500 Subject: [2.0.x] Fixed #30023 -- Prevented SQLite schema alterations while foreign key checks are enabled. Prior to this change foreign key constraint references could be left pointing at tables dropped during operations simulating unsupported table alterations because of an unexpected failure to disable foreign key constraint checks. SQLite3 does not allow disabling such checks while in a transaction so they must be disabled beforehand. Thanks ezaquarii for the report and Carlton and Tim for the review. Backport of 315357ad25a6590e7f4564ec2e56a22132b09001 from master. --- tests/test_runner/tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/test_runner') diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 708a7c2da7..c20f136b20 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -10,6 +10,7 @@ from django import db from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command +from django.core.management.base import SystemCheckError from django.test import ( TestCase, TransactionTestCase, skipUnlessDBFeature, testcases, ) @@ -201,8 +202,9 @@ class Ticket17477RegressionTests(AdminScriptTestCase): self.assertNoOutput(err) -class Sqlite3InMemoryTestDbs(TestCase): +class Sqlite3InMemoryTestDbs(TransactionTestCase): multi_db = True + available_apps = ['test_runner'] @unittest.skipUnless(all(db.connections[conn].vendor == 'sqlite' for conn in db.connections), "This is an sqlite-specific issue") -- cgit v1.3