mirror of
https://github.com/django/django.git
synced 2025-08-31 07:47:37 +00:00
Fixed #12118 -- Added shared cache support to SQLite in-memory testing.
This commit is contained in:
parent
fca866763a
commit
8c99b7920e
6 changed files with 62 additions and 10 deletions
|
@ -6,6 +6,7 @@ import copy
|
|||
import datetime
|
||||
from decimal import Decimal, Rounded
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import unittest
|
||||
import warnings
|
||||
|
@ -1201,3 +1202,21 @@ class DBTestSettingsRenamedTests(IgnoreAllDeprecationWarningsMixin, TestCase):
|
|||
def test_empty_settings(self):
|
||||
with override_settings(DATABASES=self.db_settings):
|
||||
self.handler.prepare_test_settings('default')
|
||||
|
||||
|
||||
@unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite specific test.')
|
||||
@skipUnlessDBFeature('can_share_in_memory_db')
|
||||
class TestSqliteThreadSharing(TransactionTestCase):
|
||||
available_apps = ['backends']
|
||||
|
||||
def test_database_sharing_in_threads(self):
|
||||
def create_object():
|
||||
models.Object.objects.create()
|
||||
|
||||
create_object()
|
||||
|
||||
thread = threading.Thread(target=create_object)
|
||||
thread.start()
|
||||
thread.join()
|
||||
|
||||
self.assertEqual(models.Object.objects.count(), 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue