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
19a5379c
Kaydet (Commit)
19a5379c
authored
Kas 05, 2010
tarafından
Brian Curtin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix a number of ResourceWarnings on Windows due to open pipes.
üst
5ad0bd69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
test_subprocess.py
Lib/test/test_subprocess.py
+17
-0
No files found.
Lib/test/test_subprocess.py
Dosyayı görüntüle @
19a5379c
...
...
@@ -357,6 +357,9 @@ class ProcessTestCase(BaseTestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
addCleanup
(
p
.
stderr
.
close
)
self
.
addCleanup
(
p
.
stdin
.
close
)
(
stdout
,
stderr
)
=
p
.
communicate
(
b
"banana"
)
self
.
assertEqual
(
stdout
,
b
"banana"
)
self
.
assertStderrEqual
(
stderr
,
b
"pineapple"
)
...
...
@@ -405,6 +408,9 @@ class ProcessTestCase(BaseTestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
addCleanup
(
p
.
stderr
.
close
)
self
.
addCleanup
(
p
.
stdin
.
close
)
string_to_write
=
b
"abc"
*
pipe_buf
(
stdout
,
stderr
)
=
p
.
communicate
(
string_to_write
)
self
.
assertEqual
(
stdout
,
string_to_write
)
...
...
@@ -417,6 +423,9 @@ class ProcessTestCase(BaseTestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
addCleanup
(
p
.
stderr
.
close
)
self
.
addCleanup
(
p
.
stdin
.
close
)
p
.
stdin
.
write
(
b
"banana"
)
(
stdout
,
stderr
)
=
p
.
communicate
(
b
"split"
)
self
.
assertEqual
(
stdout
,
b
"bananasplit"
)
...
...
@@ -459,6 +468,8 @@ class ProcessTestCase(BaseTestCase):
'sys.stdout.write("
\\
nline6");'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
1
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
addCleanup
(
p
.
stderr
.
close
)
(
stdout
,
stderr
)
=
p
.
communicate
()
self
.
assertEqual
(
stdout
,
"line1
\n
line2
\n
line3
\n
line4
\n
line5
\n
line6"
)
...
...
@@ -1004,6 +1015,7 @@ class Win32ProcessTestCase(BaseTestCase):
p
=
subprocess
.
Popen
([
"set"
],
shell
=
1
,
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
assertIn
(
b
"physalis"
,
p
.
stdout
.
read
())
def
test_shell_string
(
self
):
...
...
@@ -1013,6 +1025,7 @@ class Win32ProcessTestCase(BaseTestCase):
p
=
subprocess
.
Popen
(
"set"
,
shell
=
1
,
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
assertIn
(
b
"physalis"
,
p
.
stdout
.
read
())
def
test_call_string
(
self
):
...
...
@@ -1032,6 +1045,9 @@ class Win32ProcessTestCase(BaseTestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
addCleanup
(
p
.
stderr
.
close
)
self
.
addCleanup
(
p
.
stdin
.
close
)
# Wait for the interpreter to be completely initialized before
# sending any signal.
p
.
stdout
.
read
(
1
)
...
...
@@ -1142,6 +1158,7 @@ class CommandsWithSpaces (BaseTestCase):
def
with_spaces
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'stdout'
]
=
subprocess
.
PIPE
p
=
subprocess
.
Popen
(
*
args
,
**
kwargs
)
self
.
addCleanup
(
p
.
stdout
.
close
)
self
.
assertEqual
(
p
.
stdout
.
read
()
.
decode
(
"mbcs"
),
"2 [
%
r, 'ab cd']"
%
self
.
fname
...
...
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