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
2c5d124a
Commit
2c5d124a
authored
Aug 30, 2013
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forward port new tests from Issue #18851.
parent
462c8424
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+34
-0
No files found.
Lib/test/test_subprocess.py
View file @
2c5d124a
...
...
@@ -22,6 +22,10 @@ try:
import
resource
except
ImportError
:
resource
=
None
try
:
import
threading
except
ImportError
:
threading
=
None
mswindows
=
(
sys
.
platform
==
"win32"
)
...
...
@@ -987,6 +991,36 @@ class ProcessTestCase(BaseTestCase):
if
c
.
exception
.
errno
not
in
(
errno
.
ENOENT
,
errno
.
EACCES
):
raise
c
.
exception
@
unittest
.
skipIf
(
threading
is
None
,
"threading required"
)
def
test_double_close_on_error
(
self
):
# Issue #18851
fds
=
[]
def
open_fds
():
for
i
in
range
(
20
):
fds
.
extend
(
os
.
pipe
())
time
.
sleep
(
0.001
)
t
=
threading
.
Thread
(
target
=
open_fds
)
t
.
start
()
try
:
with
self
.
assertRaises
(
EnvironmentError
):
subprocess
.
Popen
([
'nonexisting_i_hope'
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
finally
:
t
.
join
()
exc
=
None
for
fd
in
fds
:
# If a double close occurred, some of those fds will
# already have been closed by mistake, and os.close()
# here will raise.
try
:
os
.
close
(
fd
)
except
OSError
as
e
:
exc
=
e
if
exc
is
not
None
:
raise
exc
def
test_issue8780
(
self
):
# Ensure that stdout is inherited from the parent
# if stdout=PIPE is not used
...
...
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