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
47b7f601
Kaydet (Commit)
47b7f601
authored
Kas 19, 2014
tarafından
Carl Meyer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23872 -- Removed sensitivity of migrations tests to CWD.
üst
4932a7b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
test_base.py
tests/migrations/test_base.py
+5
-1
test_commands.py
tests/migrations/test_commands.py
+14
-14
No files found.
tests/migrations/test_base.py
Dosyayı görüntüle @
47b7f601
from
django.test
import
TransactionTestCase
import
os
from
django.db
import
connection
from
django.db
import
connection
from
django.test
import
TransactionTestCase
from
django.utils._os
import
upath
class
MigrationTestBase
(
TransactionTestCase
):
class
MigrationTestBase
(
TransactionTestCase
):
...
@@ -8,6 +11,7 @@ class MigrationTestBase(TransactionTestCase):
...
@@ -8,6 +11,7 @@ class MigrationTestBase(TransactionTestCase):
"""
"""
available_apps
=
[
"migrations"
]
available_apps
=
[
"migrations"
]
test_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
upath
(
__file__
)))
def
get_table_description
(
self
,
table
):
def
get_table_description
(
self
,
table
):
with
connection
.
cursor
()
as
cursor
:
with
connection
.
cursor
()
as
cursor
:
...
...
tests/migrations/test_commands.py
Dosyayı görüntüle @
47b7f601
...
@@ -11,7 +11,6 @@ from django.core.management import call_command, CommandError
...
@@ -11,7 +11,6 @@ from django.core.management import call_command, CommandError
from
django.db.migrations
import
questioner
from
django.db.migrations
import
questioner
from
django.test
import
override_settings
from
django.test
import
override_settings
from
django.utils
import
six
from
django.utils
import
six
from
django.utils._os
import
upath
from
django.utils.encoding
import
force_text
from
django.utils.encoding
import
force_text
from
.models
import
UnicodeModel
,
UnserializableModel
from
.models
import
UnicodeModel
,
UnserializableModel
...
@@ -144,8 +143,6 @@ class MakeMigrationsTests(MigrationTestBase):
...
@@ -144,8 +143,6 @@ class MakeMigrationsTests(MigrationTestBase):
def
setUp
(
self
):
def
setUp
(
self
):
MakeMigrationsTests
.
creation_counter
+=
1
MakeMigrationsTests
.
creation_counter
+=
1
self
.
_cwd
=
os
.
getcwd
()
self
.
test_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
upath
(
__file__
)))
self
.
migration_dir
=
os
.
path
.
join
(
self
.
test_dir
,
'migrations_
%
d'
%
self
.
creation_counter
)
self
.
migration_dir
=
os
.
path
.
join
(
self
.
test_dir
,
'migrations_
%
d'
%
self
.
creation_counter
)
self
.
migration_pkg
=
"migrations.migrations_
%
d"
%
self
.
creation_counter
self
.
migration_pkg
=
"migrations.migrations_
%
d"
%
self
.
creation_counter
self
.
_old_models
=
apps
.
app_configs
[
'migrations'
]
.
models
.
copy
()
self
.
_old_models
=
apps
.
app_configs
[
'migrations'
]
.
models
.
copy
()
...
@@ -155,19 +152,21 @@ class MakeMigrationsTests(MigrationTestBase):
...
@@ -155,19 +152,21 @@ class MakeMigrationsTests(MigrationTestBase):
apps
.
all_models
[
'migrations'
]
=
self
.
_old_models
apps
.
all_models
[
'migrations'
]
=
self
.
_old_models
apps
.
clear_cache
()
apps
.
clear_cache
()
_cwd
=
os
.
getcwd
()
os
.
chdir
(
self
.
test_dir
)
os
.
chdir
(
self
.
test_dir
)
try
:
try
:
self
.
_rmrf
(
self
.
migration_dir
)
try
:
except
OSError
:
self
.
_rmrf
(
self
.
migration_dir
)
pass
except
OSError
:
pass
try
:
self
.
_rmrf
(
os
.
path
.
join
(
self
.
test_dir
,
"test_migrations_path_doesnt_exist"
))
except
OSError
:
pass
os
.
chdir
(
self
.
_cwd
)
try
:
self
.
_rmrf
(
os
.
path
.
join
(
self
.
test_dir
,
"test_migrations_path_doesnt_exist"
))
except
OSError
:
pass
finally
:
os
.
chdir
(
_cwd
)
def
_rmrf
(
self
,
dname
):
def
_rmrf
(
self
,
dname
):
if
os
.
path
.
commonprefix
([
self
.
test_dir
,
os
.
path
.
abspath
(
dname
)])
!=
self
.
test_dir
:
if
os
.
path
.
commonprefix
([
self
.
test_dir
,
os
.
path
.
abspath
(
dname
)])
!=
self
.
test_dir
:
...
@@ -550,7 +549,8 @@ class SquashMigrationsTest(MigrationTestBase):
...
@@ -550,7 +549,8 @@ class SquashMigrationsTest(MigrationTestBase):
Tests running the squashmigrations command.
Tests running the squashmigrations command.
"""
"""
path
=
"migrations/test_migrations/0001_squashed_0002_second.py"
path
=
"test_migrations/0001_squashed_0002_second.py"
path
=
os
.
path
.
join
(
MigrationTestBase
.
test_dir
,
path
)
def
tearDown
(
self
):
def
tearDown
(
self
):
if
os
.
path
.
exists
(
self
.
path
):
if
os
.
path
.
exists
(
self
.
path
):
...
...
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