Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
943c5b31
Commit
943c5b31
authored
Aug 16, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix subprocess test broken on Windows
parent
04ec8ce1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+11
-10
No files found.
Lib/test/test_subprocess.py
View file @
943c5b31
...
...
@@ -650,15 +650,15 @@ class ProcessTestCase(BaseTestCase):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import sys,os;'
+
SETBINARY
+
'''
\
n
if True:
s = sys.stdin.readline()
sys.stdout.
write(s
)
sys.stdout.
write(
"line2
\
\
r")
sys.stderr.
write(
"eline2
\
\
n")
sys.stdout.
buffer.write(s.encode()
)
sys.stdout.
buffer.write(b
"line2
\
\
r")
sys.stderr.
buffer.write(b
"eline2
\
\
n")
s = sys.stdin.read()
sys.stdout.
write(s+"line4
\
\
n"
)
sys.stdout.
write(s+"line5
\
\
r
\
\
n")
sys.std
err.write("eline6
\
\
n")
sys.stderr.
write("eline7
\
\
r")
sys.stderr.
write("eline8
\
\
r
\
\
n
")
sys.stdout.
buffer.write(s.encode()
)
sys.stdout.
buffer.write(b"line4
\
\
n")
sys.std
out.buffer.write(b"line5
\
\
r
\
\
n")
sys.stderr.
buffer.write(b"eline6
\
\
r")
sys.stderr.
buffer.write(b"eline7
\
\
r
\
\
nz
")
'''
],
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
...
...
@@ -668,10 +668,11 @@ class ProcessTestCase(BaseTestCase):
self
.
addCleanup
(
p
.
stderr
.
close
)
(
stdout
,
stderr
)
=
p
.
communicate
(
"line1
\
n
line3
\
n
"
)
self
.
assertEqual
(
p
.
returncode
,
0
)
self
.
assertEqual
(
"line1
\
n
line2
\
n
line3
\
n
line4
\
n
line
3
\
n
line
5
\
n
"
,
stdout
)
self
.
assertEqual
(
"line1
\
n
line2
\
n
line3
\
n
line4
\
n
line5
\
n
"
,
stdout
)
# Python debug build push something like "[42442 refs]\n"
# to stderr at exit of subprocess.
self
.
assertTrue
(
stderr
.
startswith
(
"eline2
\
n
eline6
\
n
eline7
\
n
eline8
\
n
"
))
# Don't use assertStderrEqual because it strips CR and LF from output.
self
.
assertTrue
(
stderr
.
startswith
(
"eline2
\
n
eline6
\
n
eline7
\
n
"
))
def
test_no_leaking
(
self
):
# Make sure we leak no resources
...
...
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