mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
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.
This commit is contained in:
parent
02e4b7f354
commit
2d8f06382e
1 changed files with 2 additions and 2 deletions
|
|
@ -2290,11 +2290,11 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
fds_to_keep = set(open_fds.pop() for _ in range(8))
|
fds_to_keep = set(open_fds.pop() for _ in range(8))
|
||||||
p = subprocess.Popen([sys.executable, fd_status],
|
p = subprocess.Popen([sys.executable, fd_status],
|
||||||
stdout=subprocess.PIPE, close_fds=True,
|
stdout=subprocess.PIPE, close_fds=True,
|
||||||
pass_fds=())
|
pass_fds=fds_to_keep)
|
||||||
output, ignored = p.communicate()
|
output, ignored = p.communicate()
|
||||||
remaining_fds = set(map(int, output.split(b',')))
|
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")
|
"Some fds not in pass_fds were left open")
|
||||||
self.assertIn(1, remaining_fds, "Subprocess failed")
|
self.assertIn(1, remaining_fds, "Subprocess failed")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue