Skip to content

Commit 87f7ab5

Browse files
authored
bpo-41818: test_openpty succeed on Gentoo, don't expect to fail on this platform (GH-23514)
1 parent 9d09e17 commit 87f7ab5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_pty.py

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import_module('termios')
66

77
import errno
8+
import pathlib
89
import pty
910
import os
1011
import sys
@@ -75,6 +76,19 @@ def _readline(fd):
7576

7677
def expectedFailureIfStdinIsTTY(fun):
7778
# avoid isatty() for now
79+
PLATFORM = platform.system()
80+
if PLATFORM == "Linux":
81+
os_release = pathlib.Path("/etc/os-release")
82+
if os_release.exists():
83+
# Actually the file has complex multi-line structure,
84+
# these is no need to parse it for Gentoo check
85+
if 'gentoo' in os_release.read_text().lower():
86+
# bpo-41818:
87+
# Gentoo passes the test,
88+
# all other tested Linux distributions fail.
89+
# Should not apply @unittest.expectedFailure() on Gentoo
90+
# to keep the buildbot fleet happy.
91+
return fun
7892
try:
7993
tty.tcgetattr(pty.STDIN_FILENO)
8094
return unittest.expectedFailure(fun)

0 commit comments

Comments
 (0)