Skip to content

Commit

Permalink
bpo-41818: test_openpty succeed on Gentoo, don't expect to fail on th…
Browse files Browse the repository at this point in the history
…is platform (GH-23514)
  • Loading branch information
asvetlov authored Nov 25, 2020
1 parent 9d09e17 commit 87f7ab5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Lib/test/test_pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import_module('termios')

import errno
import pathlib
import pty
import os
import sys
Expand Down Expand Up @@ -75,6 +76,19 @@ def _readline(fd):

def expectedFailureIfStdinIsTTY(fun):
# avoid isatty() for now
PLATFORM = platform.system()
if PLATFORM == "Linux":
os_release = pathlib.Path("/etc/os-release")
if os_release.exists():
# Actually the file has complex multi-line structure,
# these is no need to parse it for Gentoo check
if 'gentoo' in os_release.read_text().lower():
# bpo-41818:
# Gentoo passes the test,
# all other tested Linux distributions fail.
# Should not apply @unittest.expectedFailure() on Gentoo
# to keep the buildbot fleet happy.
return fun
try:
tty.tcgetattr(pty.STDIN_FILENO)
return unittest.expectedFailure(fun)
Expand Down

0 comments on commit 87f7ab5

Please sign in to comment.