Skip to content

Commit 615fecd

Browse files
committed
Incorporate vadmium's suggestions.
1 parent 538676a commit 615fecd

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

Lib/test/test_pty.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,17 @@ def _mock_select(self, rfds, wfds, xfds):
271271
# called with three empty lists as file descriptors to wait
272272
# on. Behavior of real select is platform-dependent and
273273
# likely infinite blocking on Linux.
274-
raise self.fail("mock select on no waitables")
274+
self.fail("mock select on no waitables")
275275
rfds_result = self.select_rfds_results.pop(0)
276276

277277
if rfds_result is _MockSelectEternalWait:
278278
raise _MockSelectEternalWait
279279
return rfds_result, [], []
280280

281281
def test__mock_stdin_stdout(self):
282-
self.assertGreater(pty.STDIN_FILENO, 2, "replaced by our mock")
282+
"""Test that _mock_stdin_stdout was called during setUp."""
283+
self.assertGreater(pty.STDIN_FILENO, 2, "stdin replaced by our mock")
284+
self.assertGreater(pty.STDOUT_FILENO, 2, "stdout replaced by our mock")
283285

284286
def test__mock_select(self):
285287
# Test the select proxy of this test class. Meta testing.
@@ -366,18 +368,6 @@ def _copy_eof_close_slave_helper(self, close_stdin):
366368
self.assertEqual(self.select_rfds_results, [])
367369
self.assertEqual(self.select_rfds_lengths, [])
368370

369-
# Test that STDIN was not touched. This test simulated the
370-
# scenario where the child process immediately closed its end of
371-
# the pipe. This means, nothing should be copied.
372-
rfds = select.select([self.read_from_stdout_fd, pty.STDIN_FILENO], [], [], 0)[0]
373-
# data or EOF is still sitting unconsumed in STDIN
374-
self.assertEqual(rfds, [pty.STDIN_FILENO])
375-
unconsumed = os.read(pty.STDIN_FILENO, 20)
376-
if close_stdin:
377-
self.assertFalse(unconsumed) #EOF
378-
else:
379-
self.assertEqual(unconsumed, b'from stdin')
380-
381371
def test__copy_eof_on_all(self):
382372
# Test the empty read EOF case on both master_fd and stdin.
383373
self._copy_eof_close_slave_helper(close_stdin=True)

0 commit comments

Comments
 (0)