Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Lib/test/test_pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def test_openpty(self):
# " An optional feature could not be imported " ... ?
raise unittest.SkipTest("Pseudo-terminals (seemingly) not functional.")

# closing master_fd can raise a SIGHUP if the process is
# the session leader: we installed a SIGHUP signal handler
# to ignore this signal.
self.addCleanup(os.close, master_fd)
self.addCleanup(os.close, slave_fd)

self.assertTrue(os.isatty(slave_fd), "slave_fd is not a tty")

if mode:
Expand Down Expand Up @@ -218,12 +224,6 @@ def test_openpty(self):
s2 = _readline(master_fd)
self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2))

os.close(slave_fd)
# closing master_fd can raise a SIGHUP if the process is
# the session leader: we installed a SIGHUP signal handler
# to ignore this signal.
os.close(master_fd)

def test_fork(self):
debug("calling pty.fork()")
pid, master_fd = pty.fork()
Expand Down