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
b04f8ddb
Kaydet (Commit)
b04f8ddb
authored
Agu 30, 2013
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21005 -- Made schema tests language-independent
Thanks Simon Charette for the review.
üst
11cd7388
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
tests.py
tests/schema/tests.py
+9
-15
No files found.
tests/schema/tests.py
Dosyayı görüntüle @
b04f8ddb
...
...
@@ -21,7 +21,6 @@ class SchemaTests(TransactionTestCase):
available_apps
=
[]
models
=
[
Author
,
AuthorWithM2M
,
Book
,
BookWithSlug
,
BookWithM2M
,
Tag
,
TagIndexed
,
TagM2MTest
,
TagUniqueRename
,
UniqueTest
]
no_table_strings
=
[
"no such table"
,
"unknown table"
,
"does not exist"
]
# Utility functions
...
...
@@ -33,30 +32,25 @@ class SchemaTests(TransactionTestCase):
"Deletes all model tables for our models for a clean test environment"
cursor
=
connection
.
cursor
()
connection
.
disable_constraint_checking
()
table_names
=
connection
.
introspection
.
table_names
(
cursor
)
for
model
in
self
.
models
:
# Remove any M2M tables first
for
field
in
model
.
_meta
.
local_many_to_many
:
with
atomic
():
try
:
tbl
=
field
.
rel
.
through
.
_meta
.
db_table
if
tbl
in
table_names
:
cursor
.
execute
(
connection
.
schema_editor
()
.
sql_delete_table
%
{
"table"
:
connection
.
ops
.
quote_name
(
field
.
rel
.
through
.
_meta
.
db_table
),
"table"
:
connection
.
ops
.
quote_name
(
tbl
),
})
except
DatabaseError
as
e
:
if
any
(
s
in
str
(
e
)
.
lower
()
for
s
in
self
.
no_table_strings
):
pass
else
:
raise
table_names
.
remove
(
tbl
)
# Then remove the main tables
with
atomic
():
try
:
tbl
=
model
.
_meta
.
db_table
if
tbl
in
table_names
:
cursor
.
execute
(
connection
.
schema_editor
()
.
sql_delete_table
%
{
"table"
:
connection
.
ops
.
quote_name
(
model
.
_meta
.
db_table
),
"table"
:
connection
.
ops
.
quote_name
(
tbl
),
})
except
DatabaseError
as
e
:
if
any
(
s
in
str
(
e
)
.
lower
()
for
s
in
self
.
no_table_strings
):
pass
else
:
raise
table_names
.
remove
(
tbl
)
connection
.
enable_constraint_checking
()
def
column_classes
(
self
,
model
):
...
...
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