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
1aa3cb60
Kaydet (Commit)
1aa3cb60
authored
Eki 10, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
(Merge 3.4) test_venv: use support.rmtree() instead of shutil.rmtree() to fix
sporadic failures on Windows
üst
8ee1513a
866c4e21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
test_venv.py
Lib/test/test_venv.py
+10
-11
No files found.
Lib/test/test_venv.py
Dosyayı görüntüle @
1aa3cb60
...
...
@@ -8,13 +8,12 @@ Licensed to the PSF under a contributor agreement.
import
ensurepip
import
os
import
os.path
import
shutil
import
struct
import
subprocess
import
sys
import
tempfile
from
test.support
import
(
captured_stdout
,
captured_stderr
,
run_unittest
,
can_symlink
,
EnvironmentVarGuard
)
can_symlink
,
EnvironmentVarGuard
,
rmtree
)
import
textwrap
import
unittest
import
venv
...
...
@@ -56,7 +55,7 @@ class BaseTest(unittest.TestCase):
self
.
exe
=
os
.
path
.
split
(
executable
)[
-
1
]
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
def
run_with_capture
(
self
,
func
,
*
args
,
**
kwargs
):
with
captured_stdout
()
as
output
:
...
...
@@ -83,7 +82,7 @@ class BasicTest(BaseTest):
"""
Test the create function with default arguments.
"""
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
)
self
.
isdir
(
self
.
bindir
)
self
.
isdir
(
self
.
include
)
...
...
@@ -121,7 +120,7 @@ class BasicTest(BaseTest):
self
.
assertEqual
(
sys
.
base_exec_prefix
,
sys
.
exec_prefix
)
# check a venv's prefixes
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
)
envpy
=
os
.
path
.
join
(
self
.
env_dir
,
self
.
bindir
,
self
.
exe
)
cmd
=
[
envpy
,
'-c'
,
None
]
...
...
@@ -188,7 +187,7 @@ class BasicTest(BaseTest):
if
os
.
path
.
islink
(
fn
)
or
os
.
path
.
isfile
(
fn
):
os
.
remove
(
fn
)
elif
os
.
path
.
isdir
(
fn
):
shutil
.
rmtree
(
fn
)
rmtree
(
fn
)
def
test_unoverwritable_fails
(
self
):
#create a file clashing with directories in the env dir
...
...
@@ -254,7 +253,7 @@ class BasicTest(BaseTest):
"""
Test that the sys.executable value is as expected.
"""
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
)
envpy
=
os
.
path
.
join
(
os
.
path
.
realpath
(
self
.
env_dir
),
self
.
bindir
,
self
.
exe
)
cmd
=
[
envpy
,
'-c'
,
'import sys; print(sys.executable)'
]
...
...
@@ -268,7 +267,7 @@ class BasicTest(BaseTest):
"""
Test that the sys.executable value is as expected.
"""
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
builder
=
venv
.
EnvBuilder
(
clear
=
True
,
symlinks
=
True
)
builder
.
create
(
self
.
env_dir
)
envpy
=
os
.
path
.
join
(
os
.
path
.
realpath
(
self
.
env_dir
),
self
.
bindir
,
self
.
exe
)
...
...
@@ -299,12 +298,12 @@ class EnsurePipTest(BaseTest):
def
test_no_pip_by_default
(
self
):
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
)
self
.
assert_pip_not_installed
()
def
test_explicit_no_pip
(
self
):
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
,
with_pip
=
False
)
self
.
assert_pip_not_installed
()
...
...
@@ -321,7 +320,7 @@ class EnsurePipTest(BaseTest):
# Requesting pip fails without SSL (http://bugs.python.org/issue19744)
@unittest.skipIf
(
ssl
is
None
,
ensurepip
.
_MISSING_SSL_MESSAGE
)
def
test_with_pip
(
self
):
shutil
.
rmtree
(
self
.
env_dir
)
rmtree
(
self
.
env_dir
)
with
EnvironmentVarGuard
()
as
envvars
:
# pip's cross-version compatibility may trigger deprecation
# warnings in current versions of Python. Ensure related
...
...
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