summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-10-03 20:15:44 -0400
committerTim Graham <timograham@gmail.com>2017-10-03 20:17:12 -0400
commitd0c761d3f84aa340175b5f8646d7b2f12d2e75be (patch)
treeb40efa05dacc66106ed85996b91dc88466733a58
parenta2626cb3fec2e67bb0ec4be2e992e1a836b7567e (diff)
Refs #28584 -- Removed unused DatabaseFeatures.can_share_in_memory_db.
-rw-r--r--django/db/backends/sqlite3/base.py4
-rw-r--r--django/db/backends/sqlite3/creation.py13
-rw-r--r--django/db/backends/sqlite3/features.py1
-rw-r--r--tests/backends/sqlite/tests.py21
4 files changed, 6 insertions, 33 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index eabcdfabe5..40b205cf30 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -153,9 +153,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'for controlling thread shareability.',
RuntimeWarning
)
- kwargs.update({'check_same_thread': False})
- if self.features.can_share_in_memory_db:
- kwargs.update({'uri': True})
+ kwargs.update({'check_same_thread': False, 'uri': True})
return kwargs
def get_new_connection(self, conn_params):
diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py
index 5cde383108..3c6fb291fa 100644
--- a/django/db/backends/sqlite3/creation.py
+++ b/django/db/backends/sqlite3/creation.py
@@ -2,7 +2,6 @@ import os
import shutil
import sys
-from django.core.exceptions import ImproperlyConfigured
from django.db.backends.base.creation import BaseDatabaseCreation
@@ -14,18 +13,10 @@ class DatabaseCreation(BaseDatabaseCreation):
def _get_test_db_name(self):
test_database_name = self.connection.settings_dict['TEST']['NAME']
- can_share_in_memory_db = self.connection.features.can_share_in_memory_db
if not test_database_name:
test_database_name = ':memory:'
- if can_share_in_memory_db:
- if test_database_name == ':memory:':
- return 'file:memorydb_%s?mode=memory&cache=shared' % self.connection.alias
- elif 'mode=memory' in test_database_name:
- raise ImproperlyConfigured(
- "Using a shared memory database with `mode=memory` in the "
- "database name is not supported in your environment, "
- "use `:memory:` instead."
- )
+ if test_database_name == ':memory:':
+ return 'file:memorydb_%s?mode=memory&cache=shared' % self.connection.alias
return test_database_name
def _create_test_db(self, verbosity, autoclobber, keepdb=False):
diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py
index df773be3ca..1c3d2a7378 100644
--- a/django/db/backends/sqlite3/features.py
+++ b/django/db/backends/sqlite3/features.py
@@ -30,7 +30,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_cast_with_precision = False
uses_savepoints = True
can_release_savepoints = True
- can_share_in_memory_db = True
@cached_property
def supports_stddev(self):
diff --git a/tests/backends/sqlite/tests.py b/tests/backends/sqlite/tests.py
index 838835ccdd..3addcc8c34 100644
--- a/tests/backends/sqlite/tests.py
+++ b/tests/backends/sqlite/tests.py
@@ -2,12 +2,9 @@ import re
import threading
import unittest
-from django.core.exceptions import ImproperlyConfigured
from django.db import connection
from django.db.models import Avg, StdDev, Sum, Variance
-from django.test import (
- TestCase, TransactionTestCase, override_settings, skipUnlessDBFeature,
-)
+from django.test import TestCase, TransactionTestCase, override_settings
from ..models import Item, Object, Square
@@ -56,19 +53,8 @@ class Tests(TestCase):
'NAME': 'file:memorydb_test?mode=memory&cache=shared',
}
}
- wrapper = DatabaseWrapper(settings_dict)
- creation = wrapper.creation
- if creation.connection.features.can_share_in_memory_db:
- expected = creation.connection.settings_dict['TEST']['NAME']
- self.assertEqual(creation._get_test_db_name(), expected)
- else:
- msg = (
- "Using a shared memory database with `mode=memory` in the "
- "database name is not supported in your environment, "
- "use `:memory:` instead."
- )
- with self.assertRaisesMessage(ImproperlyConfigured, msg):
- creation._get_test_db_name()
+ creation = DatabaseWrapper(settings_dict).creation
+ self.assertEqual(creation._get_test_db_name(), creation.connection.settings_dict['TEST']['NAME'])
@unittest.skipUnless(connection.vendor == 'sqlite', 'Test only for SQLite')
@@ -124,7 +110,6 @@ class EscapingChecksDebug(EscapingChecks):
@unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite tests')
-@skipUnlessDBFeature('can_share_in_memory_db')
class ThreadSharing(TransactionTestCase):
available_apps = ['backends']