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
56c80e8b
Kaydet (Commit)
56c80e8b
authored
Mar 08, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoided modifying current environment in admin_scripts tests
üst
8446a243
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
tests.py
tests/admin_scripts/tests.py
+7
-13
No files found.
tests/admin_scripts/tests.py
Dosyayı görüntüle @
56c80e8b
...
...
@@ -122,35 +122,29 @@ class AdminScriptTestCase(unittest.TestCase):
django_dir
=
os
.
path
.
dirname
(
tests_dir
)
ext_backend_base_dirs
=
self
.
_ext_backend_paths
()
#
Remember the old environment
old_django_settings_module
=
os
.
environ
.
get
(
'DJANGO_SETTINGS_MODULE'
,
None
)
#
Define a temporary environment for the subprocess
test_environ
=
os
.
environ
.
copy
(
)
if
sys
.
platform
.
startswith
(
'java'
):
python_path_var_name
=
'JYTHONPATH'
else
:
python_path_var_name
=
'PYTHONPATH'
old_python_path
=
os
.
environ
.
get
(
python_path_var_name
,
None
)
old_cwd
=
os
.
getcwd
()
# Set the test environment
if
settings_file
:
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
settings_file
elif
'DJANGO_SETTINGS_MODULE'
in
os
.
environ
:
del
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
test_
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
settings_file
elif
'DJANGO_SETTINGS_MODULE'
in
test_
environ
:
del
test_
environ
[
'DJANGO_SETTINGS_MODULE'
]
python_path
=
[
base_dir
,
django_dir
,
tests_dir
]
python_path
.
extend
(
ext_backend_base_dirs
)
os
.
environ
[
python_path_var_name
]
=
os
.
pathsep
.
join
(
python_path
)
test_
environ
[
python_path_var_name
]
=
os
.
pathsep
.
join
(
python_path
)
# Move to the test directory and run
os
.
chdir
(
test_dir
)
out
,
err
=
subprocess
.
Popen
([
sys
.
executable
,
script
]
+
args
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
.
communicate
()
# Restore the old environment
if
old_django_settings_module
:
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
old_django_settings_module
if
old_python_path
:
os
.
environ
[
python_path_var_name
]
=
old_python_path
env
=
test_environ
,
universal_newlines
=
True
)
.
communicate
()
# Move back to the old working directory
os
.
chdir
(
old_cwd
)
...
...
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