Skip to content

Commit 4bb22ca

Browse files
committed
In Lib/test/test_pty.py, wrap @expectedfailure to check if pty.STDIN_FILENO is a tty
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
1 parent 323fc9c commit 4bb22ca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Lib/test/test_pty.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ def _readline(fd):
6969
reader = io.FileIO(fd, mode='rb', closefd=False)
7070
return reader.readline()
7171

72+
def expectedFailureIfStdinIsTTY(fun):
73+
# avoid isatty() for now
74+
try:
75+
tty.tcgetattr(pty.STDIN_FILENO)
76+
return unittest.expectedFailure(fun)
77+
except tty.error:
78+
pass
79+
return fun
80+
7281
def expectedFailureOnBSD(fun):
7382
if platform.system().endswith("BSD"):
7483
return unittest.expectedFailure(fun)
@@ -103,7 +112,7 @@ def handle_sighup(signum, frame):
103112
# signal: just ignore the signal.
104113
pass
105114

106-
@unittest.expectedFailure
115+
@expectedFailureIfStdinIsTTY
107116
def test_openpty(self):
108117
try:
109118
mode = tty.tcgetattr(pty.STDIN_FILENO)

0 commit comments

Comments
 (0)