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
45db842c
Kaydet (Commit)
45db842c
authored
Eki 24, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23652 -- Restored database name after destroying test database
Thanks Bjarkias for the report.
üst
1bdf1cb1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
creation.py
django/db/backends/creation.py
+4
-0
tests.py
tests/test_runner/tests.py
+13
-0
No files found.
django/db/backends/creation.py
Dosyayı görüntüle @
45db842c
...
...
@@ -524,6 +524,10 @@ class BaseDatabaseCreation(object):
if
not
keepdb
:
self
.
_destroy_test_db
(
test_database_name
,
verbosity
)
# Restore the original database name
settings
.
DATABASES
[
self
.
connection
.
alias
][
"NAME"
]
=
old_database_name
self
.
connection
.
settings_dict
[
"NAME"
]
=
old_database_name
def
_destroy_test_db
(
self
,
test_database_name
,
verbosity
):
"""
Internal implementation - remove the test db tables.
...
...
tests/test_runner/tests.py
Dosyayı görüntüle @
45db842c
...
...
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
import
unittest
from
django
import
db
from
django.conf
import
settings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.management
import
call_command
from
django.db.backends.dummy.base
import
DatabaseCreation
...
...
@@ -336,6 +337,18 @@ class SetupDatabasesTests(unittest.TestCase):
self
.
assertEqual
(
destroyed_names
.
count
(
'dbname'
),
1
)
def
test_destroy_test_db_restores_db_name
(
self
):
db
.
connections
=
db
.
ConnectionHandler
({
'default'
:
{
'ENGINE'
:
settings
.
DATABASES
[
db
.
DEFAULT_DB_ALIAS
][
"ENGINE"
],
'NAME'
:
'xxx_test_database'
,
},
})
# Using the real current name as old_name to not mess with the test suite.
old_name
=
settings
.
DATABASES
[
db
.
DEFAULT_DB_ALIAS
][
"NAME"
]
db
.
connections
[
'default'
]
.
creation
.
destroy_test_db
(
old_name
,
verbosity
=
0
,
keepdb
=
True
)
self
.
assertEqual
(
db
.
connections
[
'default'
]
.
settings_dict
[
"NAME"
],
old_name
)
def
test_serialization
(
self
):
serialize
=
[]
DatabaseCreation
.
create_test_db
=
(
...
...
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