mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.13] gh-120678: Guard against stdin.fileno() being unavailable (GH-121924) (#121929)
gh-120678: Guard against stdin.fileno() being unavailable (GH-121924)
(cherry picked from commit 19cbf8fd63
)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
ea364204db
commit
91e098f44d
1 changed files with 14 additions and 6 deletions
|
@ -491,15 +491,23 @@ class TestPyReplOutput(TestCase):
|
|||
|
||||
def test_stdin_is_tty(self):
|
||||
# Used during test log analysis to figure out if a TTY was available.
|
||||
if os.isatty(sys.stdin.fileno()):
|
||||
return
|
||||
self.skipTest("stdin is not a tty")
|
||||
try:
|
||||
if os.isatty(sys.stdin.fileno()):
|
||||
return
|
||||
except OSError as ose:
|
||||
self.skipTest(f"stdin tty check failed: {ose}")
|
||||
else:
|
||||
self.skipTest("stdin is not a tty")
|
||||
|
||||
def test_stdout_is_tty(self):
|
||||
# Used during test log analysis to figure out if a TTY was available.
|
||||
if os.isatty(sys.stdout.fileno()):
|
||||
return
|
||||
self.skipTest("stdout is not a tty")
|
||||
try:
|
||||
if os.isatty(sys.stdout.fileno()):
|
||||
return
|
||||
except OSError as ose:
|
||||
self.skipTest(f"stdout tty check failed: {ose}")
|
||||
else:
|
||||
self.skipTest("stdout is not a tty")
|
||||
|
||||
def test_basic(self):
|
||||
reader = self.prepare_reader(code_to_events("1+1\n"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue