[Python-checkins] bpo-32369: test_subprocess: Fix pass_fds check in test_close_fds() (#4920)
Gregory P. Smith
webhook-mailer at python.org
Mon Dec 18 15:26:54 EST 2017
https://github.com/python/cpython/commit/2d8f06382e7d5a759ca554110a699a397114824a
commit: 2d8f06382e7d5a759ca554110a699a397114824a
branch: master
author: izbyshev <izbyshev at users.noreply.github.com>
committer: Gregory P. Smith <greg at krypto.org>
date: 2017年12月18日T12:26:49-08:00
summary:
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.
files:
M Lib/test/test_subprocess.py
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index bd3b9b46f76..540ad34d3f5 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -2290,11 +2290,11 @@ def test_close_fds(self):
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")
More information about the Python-checkins
mailing list