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
2ae8a8a7
Kaydet (Commit)
2ae8a8a7
authored
Haz 19, 2013
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test running with new apps stuff/migrate actually running migrations
üst
9daf81b9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
12 deletions
+33
-12
global_settings.py
django/conf/global_settings.py
+7
-0
creation.py
django/db/backends/creation.py
+4
-3
loader.py
django/db/migrations/loader.py
+9
-2
runner.py
django/test/runner.py
+1
-1
test_executor.py
tests/migrations/test_executor.py
+4
-0
test_loader.py
tests/migrations/test_loader.py
+4
-2
test_operations.py
tests/migrations/test_operations.py
+2
-2
test_writer.py
tests/migrations/test_writer.py
+2
-2
No files found.
django/conf/global_settings.py
Dosyayı görüntüle @
2ae8a8a7
...
@@ -602,3 +602,10 @@ STATICFILES_FINDERS = (
...
@@ -602,3 +602,10 @@ STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
,
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
,
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
)
##############
# MIGRATIONS #
##############
# Migration module overrides for apps, by app label.
MIGRATION_MODULES
=
{}
django/db/backends/creation.py
Dosyayı görüntüle @
2ae8a8a7
...
@@ -331,14 +331,15 @@ class BaseDatabaseCreation(object):
...
@@ -331,14 +331,15 @@ class BaseDatabaseCreation(object):
settings
.
DATABASES
[
self
.
connection
.
alias
][
"NAME"
]
=
test_database_name
settings
.
DATABASES
[
self
.
connection
.
alias
][
"NAME"
]
=
test_database_name
self
.
connection
.
settings_dict
[
"NAME"
]
=
test_database_name
self
.
connection
.
settings_dict
[
"NAME"
]
=
test_database_name
# Report
syncdb
messages at one level lower than that requested.
# Report
migrate
messages at one level lower than that requested.
# This ensures we don't get flooded with messages during testing
# This ensures we don't get flooded with messages during testing
# (unless you really ask to be flooded)
# (unless you really ask to be flooded)
call_command
(
'
syncdb
'
,
call_command
(
'
migrate
'
,
verbosity
=
max
(
verbosity
-
1
,
0
),
verbosity
=
max
(
verbosity
-
1
,
0
),
interactive
=
False
,
interactive
=
False
,
database
=
self
.
connection
.
alias
,
database
=
self
.
connection
.
alias
,
load_initial_data
=
False
)
load_initial_data
=
False
,
test_database
=
True
)
# We need to then do a flush to ensure that any data installed by
# We need to then do a flush to ensure that any data installed by
# custom SQL has been removed. The only test data should come from
# custom SQL has been removed. The only test data should come from
...
...
django/db/migrations/loader.py
Dosyayı görüntüle @
2ae8a8a7
...
@@ -4,6 +4,7 @@ from django.utils.functional import cached_property
...
@@ -4,6 +4,7 @@ from django.utils.functional import cached_property
from
django.db.models.loading
import
cache
from
django.db.models.loading
import
cache
from
django.db.migrations.recorder
import
MigrationRecorder
from
django.db.migrations.recorder
import
MigrationRecorder
from
django.db.migrations.graph
import
MigrationGraph
from
django.db.migrations.graph
import
MigrationGraph
from
django.conf
import
settings
class
MigrationLoader
(
object
):
class
MigrationLoader
(
object
):
...
@@ -36,6 +37,12 @@ class MigrationLoader(object):
...
@@ -36,6 +37,12 @@ class MigrationLoader(object):
self
.
disk_migrations
=
None
self
.
disk_migrations
=
None
self
.
applied_migrations
=
None
self
.
applied_migrations
=
None
def
migration_module
(
self
,
app_label
):
if
app_label
in
settings
.
MIGRATION_MODULES
:
return
settings
.
MIGRATION_MODULES
[
app_label
]
app
=
cache
.
get_app
(
app_label
)
return
"."
.
join
(
app
.
__name__
.
split
(
"."
)[:
-
1
]
+
[
"migrations"
])
def
load_disk
(
self
):
def
load_disk
(
self
):
"""
"""
Loads the migrations from all INSTALLED_APPS from disk.
Loads the migrations from all INSTALLED_APPS from disk.
...
@@ -44,8 +51,8 @@ class MigrationLoader(object):
...
@@ -44,8 +51,8 @@ class MigrationLoader(object):
self
.
unmigrated_apps
=
set
()
self
.
unmigrated_apps
=
set
()
for
app
in
cache
.
get_apps
():
for
app
in
cache
.
get_apps
():
# Get the migrations module directory
# Get the migrations module directory
module_name
=
"."
.
join
(
app
.
__name__
.
split
(
"."
)[:
-
1
]
+
[
"migrations"
])
app_label
=
app
.
__name__
.
split
(
"."
)[
-
2
]
app_label
=
module_name
.
split
(
"."
)[
-
2
]
module_name
=
self
.
migration_module
(
app_label
)
try
:
try
:
module
=
import_module
(
module_name
)
module
=
import_module
(
module_name
)
except
ImportError
as
e
:
except
ImportError
as
e
:
...
...
django/test/runner.py
Dosyayı görüntüle @
2ae8a8a7
...
@@ -266,7 +266,7 @@ def setup_databases(verbosity, interactive, **kwargs):
...
@@ -266,7 +266,7 @@ def setup_databases(verbosity, interactive, **kwargs):
# Second pass -- actually create the databases.
# Second pass -- actually create the databases.
old_names
=
[]
old_names
=
[]
mirrors
=
[]
mirrors
=
[]
for
signature
,
(
db_name
,
aliases
)
in
dependency_ordered
(
for
signature
,
(
db_name
,
aliases
)
in
dependency_ordered
(
test_databases
.
items
(),
dependencies
):
test_databases
.
items
(),
dependencies
):
test_db_name
=
None
test_db_name
=
None
...
...
tests/migrations/test_executor.py
Dosyayı görüntüle @
2ae8a8a7
from
django.test
import
TransactionTestCase
from
django.test
import
TransactionTestCase
from
django.test.utils
import
override_settings
from
django.db
import
connection
from
django.db
import
connection
from
django.db.migrations.executor
import
MigrationExecutor
from
django.db.migrations.executor
import
MigrationExecutor
...
@@ -11,6 +12,9 @@ class ExecutorTests(TransactionTestCase):
...
@@ -11,6 +12,9 @@ class ExecutorTests(TransactionTestCase):
test failures first, as they may be propagating into here.
test failures first, as they may be propagating into here.
"""
"""
available_apps
=
[
"migrations"
]
@override_settings
(
MIGRATION_MODULES
=
{
"migrations"
:
"migrations.test_migrations"
})
def
test_run
(
self
):
def
test_run
(
self
):
"""
"""
Tests running a simple set of migrations.
Tests running a simple set of migrations.
...
...
tests/migrations/test_loader.py
Dosyayı görüntüle @
2ae8a8a7
from
django.test
import
TestCase
,
TransactionTestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.db
import
connection
from
django.db
import
connection
from
django.db.migrations.loader
import
MigrationLoader
from
django.db.migrations.loader
import
MigrationLoader
from
django.db.migrations.recorder
import
MigrationRecorder
from
django.db.migrations.recorder
import
MigrationRecorder
...
@@ -30,12 +31,13 @@ class RecorderTests(TestCase):
...
@@ -30,12 +31,13 @@ class RecorderTests(TestCase):
)
)
class
LoaderTests
(
T
ransactionT
estCase
):
class
LoaderTests
(
TestCase
):
"""
"""
Tests the disk and database loader, and running through migrations
Tests the disk and database loader, and running through migrations
in memory.
in memory.
"""
"""
@override_settings
(
MIGRATION_MODULES
=
{
"migrations"
:
"migrations.test_migrations"
})
def
test_load
(
self
):
def
test_load
(
self
):
"""
"""
Makes sure the loader can load the migrations for the test apps,
Makes sure the loader can load the migrations for the test apps,
...
...
tests/migrations/test_operations.py
Dosyayı görüntüle @
2ae8a8a7
from
django.test
import
T
ransactionT
estCase
from
django.test
import
TestCase
from
django.db
import
connection
,
models
,
migrations
from
django.db
import
connection
,
models
,
migrations
from
django.db.migrations.state
import
ProjectState
from
django.db.migrations.state
import
ProjectState
class
OperationTests
(
T
ransactionT
estCase
):
class
OperationTests
(
TestCase
):
"""
"""
Tests running the operations and making sure they do what they say they do.
Tests running the operations and making sure they do what they say they do.
Each test looks at their state changing, and then their database operation -
Each test looks at their state changing, and then their database operation -
...
...
tests/migrations/test_writer.py
Dosyayı görüntüle @
2ae8a8a7
# encoding: utf8
# encoding: utf8
import
datetime
import
datetime
from
django.utils
import
six
from
django.utils
import
six
from
django.test
import
T
ransactionT
estCase
from
django.test
import
TestCase
from
django.db.migrations.writer
import
MigrationWriter
from
django.db.migrations.writer
import
MigrationWriter
from
django.db
import
models
,
migrations
from
django.db
import
models
,
migrations
class
WriterTests
(
T
ransactionT
estCase
):
class
WriterTests
(
TestCase
):
"""
"""
Tests the migration writer (makes migration files from Migration instances)
Tests the migration writer (makes migration files from Migration instances)
"""
"""
...
...
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