Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
8bba81fd
Unverified
Kaydet (Commit)
8bba81fd
authored
Mar 21, 2019
tarafından
Steve Dower
Kaydeden (comit)
GitHub
Mar 21, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-35978: Correctly skips venv tests in venvs (GH-12220)
Also fixes venvs from the build directory on Windows.
üst
7ee88bf3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
test_venv.py
Lib/test/test_venv.py
+10
-5
__init__.py
Lib/venv/__init__.py
+12
-7
No files found.
Lib/test/test_venv.py
Dosyayı görüntüle @
8bba81fd
...
...
@@ -24,8 +24,12 @@ try:
except
ImportError
:
ctypes
=
None
skipInVenv
=
unittest
.
skipIf
(
sys
.
prefix
!=
sys
.
base_prefix
,
'Test not appropriate in a venv'
)
# Platforms that set sys._base_executable can create venvs from within
# another venv, so no need to skip tests that require venv.create().
requireVenvCreate
=
unittest
.
skipUnless
(
hasattr
(
sys
,
'_base_executable'
)
or
sys
.
prefix
==
sys
.
base_prefix
,
'cannot run venv.create from within a venv on this platform'
)
def
check_output
(
cmd
,
encoding
=
None
):
p
=
subprocess
.
Popen
(
cmd
,
...
...
@@ -126,7 +130,7 @@ class BasicTest(BaseTest):
self
.
assertEqual
(
context
.
prompt
,
'(My prompt) '
)
self
.
assertIn
(
"prompt = 'My prompt'
\n
"
,
data
)
@
skipInVenv
@
requireVenvCreate
def
test_prefixes
(
self
):
"""
Test that the prefix values are as expected.
...
...
@@ -262,7 +266,7 @@ class BasicTest(BaseTest):
# run the test, the pyvenv.cfg in the venv created in the test will
# point to the venv being used to run the test, and we lose the link
# to the source build - so Python can't initialise properly.
@
skipInVenv
@
requireVenvCreate
def
test_executable
(
self
):
"""
Test that the sys.executable value is as expected.
...
...
@@ -306,6 +310,7 @@ class BasicTest(BaseTest):
)
self
.
assertEqual
(
out
.
strip
(),
'0'
)
@requireVenvCreate
def
test_multiprocessing
(
self
):
"""
Test that the multiprocessing is able to spawn.
...
...
@@ -319,7 +324,7 @@ class BasicTest(BaseTest):
'print(Pool(1).apply_async("Python".lower).get(3))'
])
self
.
assertEqual
(
out
.
strip
(),
"python"
.
encode
())
@
skipInVenv
@
requireVenvCreate
class
EnsurePipTest
(
BaseTest
):
"""Test venv module installation of pip."""
def
assert_pip_not_installed
(
self
):
...
...
Lib/venv/__init__.py
Dosyayı görüntüle @
8bba81fd
...
...
@@ -178,18 +178,23 @@ class EnvBuilder:
# On Windows, we rewrite symlinks to our base python.exe into
# copies of venvlauncher.exe
basename
,
ext
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
src
))
if
basename
.
endswith
(
'_d'
):
ext
=
'_d'
+
ext
basename
=
basename
[:
-
2
]
if
sysconfig
.
is_python_build
(
True
):
srcfn
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"scripts"
,
"nt"
,
basename
+
ext
)
# Builds or venv's from builds need to remap source file
# locations, as we do not put them into Lib/venv/scripts
if
sysconfig
.
is_python_build
(
True
)
or
not
os
.
path
.
isfile
(
srcfn
):
if
basename
.
endswith
(
'_d'
):
ext
=
'_d'
+
ext
basename
=
basename
[:
-
2
]
if
basename
==
'python'
:
basename
=
'venvlauncher'
elif
basename
==
'pythonw'
:
basename
=
'venvwlauncher'
s
cripts
=
os
.
path
.
dirname
(
src
)
s
rc
=
os
.
path
.
join
(
os
.
path
.
dirname
(
src
),
basename
+
ext
)
else
:
scripts
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"scripts"
,
"nt"
)
src
=
os
.
path
.
join
(
scripts
,
basename
+
ext
)
src
=
srcfn
shutil
.
copyfile
(
src
,
dst
)
...
...
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