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
68a11fc3
Kaydet (Commit)
68a11fc3
authored
Eki 08, 2012
tarafından
Chris Jerdonek
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #16115: Merge test improvements from 3.3.
üst
4907b0a2
776cb199
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
test_subprocess.py
Lib/test/test_subprocess.py
+27
-10
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_subprocess.py
Dosyayı görüntüle @
68a11fc3
...
...
@@ -192,6 +192,33 @@ class ProcessTestCase(BaseTestCase):
p
.
wait
()
self
.
assertEqual
(
p
.
stderr
,
None
)
def
_assert_python
(
self
,
pre_args
,
**
kwargs
):
# We include sys.exit() to prevent the test runner from hanging
# whenever python is found.
args
=
pre_args
+
[
"import sys; sys.exit(47)"
]
p
=
subprocess
.
Popen
(
args
,
**
kwargs
)
p
.
wait
()
self
.
assertEqual
(
47
,
p
.
returncode
)
def
test_executable
(
self
):
# Check that the executable argument works.
self
.
_assert_python
([
"doesnotexist"
,
"-c"
],
executable
=
sys
.
executable
)
def
test_executable_takes_precedence
(
self
):
# Check that the executable argument takes precedence over args[0].
#
# Verify first that the call succeeds without the executable arg.
pre_args
=
[
sys
.
executable
,
"-c"
]
self
.
_assert_python
(
pre_args
)
self
.
assertRaises
(
FileNotFoundError
,
self
.
_assert_python
,
pre_args
,
executable
=
"doesnotexist"
)
@unittest.skipIf
(
mswindows
,
"executable argument replaces shell"
)
def
test_executable_replaces_shell
(
self
):
# Check that the executable argument replaces the default shell
# when shell=True.
self
.
_assert_python
([],
executable
=
sys
.
executable
,
shell
=
True
)
# For use in the test_cwd* tests below.
def
_normalize_cwd
(
self
,
cwd
):
# Normalize an expected cwd (for Tru64 support).
...
...
@@ -299,16 +326,6 @@ class ProcessTestCase(BaseTestCase):
# argument. For test runs in the build directory, see #7774.
self
.
_assert_cwd
(
''
,
"somethingyoudonthave"
,
executable
=
sys
.
executable
)
def
test_executable_precedence
(
self
):
# To the precedence of executable argument over args[0]
# For a normal installation, it should work without 'cwd'
# argument. For test runs in the build directory, see #7774.
python_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
sys
.
executable
))
p
=
subprocess
.
Popen
([
"nonexistent"
,
"-c"
,
'import sys; sys.exit(42)'
],
executable
=
sys
.
executable
,
cwd
=
python_dir
)
p
.
wait
()
self
.
assertEqual
(
p
.
returncode
,
42
)
def
test_stdin_pipe
(
self
):
# stdin redirection
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
...
...
Misc/NEWS
Dosyayı görüntüle @
68a11fc3
...
...
@@ -129,6 +129,9 @@ Extension Modules
Tests
-----
- Issue #16115: Add some tests for the executable argument to
subprocess.Popen(). Initial patch by Kushal Das.
- Issue #15304: Fix warning message when `os.chdir()` fails inside
`test.support.temp_cwd()`. Patch by Chris Jerdonek.
...
...
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