Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
3543fec3
Kaydet (Commit)
3543fec3
authored
Eki 05, 2015
tarafından
Riccardo Magliocchetti
Kaydeden (comit)
Tim Graham
Eki 06, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #12118 -- Allowed "mode=memory" in SQLite test database names.
üst
6afa6818
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
creation.py
django/db/backends/sqlite3/creation.py
+5
-3
1.8.6.txt
docs/releases/1.8.6.txt
+3
-0
tests.py
tests/backends/tests.py
+24
-0
No files found.
django/db/backends/sqlite3/creation.py
Dosyayı görüntüle @
3543fec3
...
...
@@ -11,14 +11,16 @@ 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
test_database_name
and
test_database_name
!=
':memory:'
:
if
'mode=memory'
in
test_database_name
:
if
'mode=memory'
in
test_database_name
and
not
can_share_in_memory_db
:
raise
ImproperlyConfigured
(
"Using `mode=memory` parameter in the database name is not allowed, "
"Using a shared memory database with `mode=memory` in the "
"database name is not supported in your environment, "
"use `:memory:` instead."
)
return
test_database_name
if
self
.
connection
.
features
.
can_share_in_memory_db
:
if
can_share_in_memory_db
:
return
'file:memorydb_
%
s?mode=memory&cache=shared'
%
self
.
connection
.
alias
return
':memory:'
...
...
docs/releases/1.8.6.txt
Dosyayı görüntüle @
3543fec3
...
...
@@ -11,3 +11,6 @@ Bugfixes
* Fixed a regression causing ``ModelChoiceField`` to ignore
``prefetch_related()`` on its queryset (:ticket:`25496`).
* Allowed "mode=memory" in SQLite test database name if supported
(:ticket:`12118`).
tests/backends/tests.py
Dosyayı görüntüle @
3543fec3
...
...
@@ -142,6 +142,30 @@ class SQLiteTests(TestCase):
models
.
Item
.
objects
.
all
()
.
aggregate
,
**
{
'complex'
:
aggregate
(
'last_modified'
)
+
aggregate
(
'last_modified'
)})
def
test_memory_db_test_name
(
self
):
"""
A named in-memory db should be allowed where supported.
"""
from
django.db.backends.sqlite3.base
import
DatabaseWrapper
settings_dict
=
{
'TEST'
:
{
'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
()
@unittest.skipUnless
(
connection
.
vendor
==
'postgresql'
,
"Test only for PostgreSQL"
)
class
PostgreSQLTests
(
TestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment