summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorizbyshev <izbyshev@users.noreply.github.com>2017-12-18 20:26:49 (GMT)
committerGregory P. Smith <greg@krypto.org>2017-12-18 20:26:49 (GMT)
commit2d8f06382e7d5a759ca554110a699a397114824a (patch)
tree32c4a259d4992e732710d1860d09dece1eae48b7 /Lib/test/test_subprocess.py
parent02e4b7f35419a632b21d17435a61729b97ca0804 (diff)
downloadcpython-2d8f06382e7d5a759ca554110a699a397114824a.zip
cpython-2d8f06382e7d5a759ca554110a699a397114824a.tar.gz
cpython-2d8f06382e7d5a759ca554110a699a397114824a.tar.bz2
bpo-32369: test_subprocess: Fix pass_fds check in test_close_fds() (#4920)
The last part of test_close_fds() doesn't match its own comment. The following assertion always holds because fds_to_keep and open_fds are disjoint by construction. self.assertFalse(remaining_fds & fds_to_keep & open_fds, "Some fds not in pass_fds were left open") Fix the code to match the message in the assertion.
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index bd3b9b4..540ad34 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -2290,11 +2290,11 @@ class POSIXProcessTestCase(BaseTestCase):
fds_to_keep = set(open_fds.pop() for _ in range(8))
p = subprocess.Popen([sys.executable, fd_status],
stdout=subprocess.PIPE, close_fds=True,
- pass_fds=())
+ pass_fds=fds_to_keep)
output, ignored = p.communicate()
remaining_fds = set(map(int, output.split(b',')))
- self.assertFalse(remaining_fds & fds_to_keep & open_fds,
+ self.assertFalse((remaining_fds - fds_to_keep) & open_fds,
"Some fds not in pass_fds were left open")
self.assertIn(1, remaining_fds, "Subprocess failed")