From 4ba515dec0180a7f11fb77c2141d873870991ba0 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Wed, 25 Nov 2020 17:04:30 +0200 Subject: [PATCH 1/2] test_openpty succeded on Gentoo, don't expect to fail it on this platform --- Lib/test/test_pty.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 7de568806ed7d8..4aff7468a0519a 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -5,6 +5,7 @@ import_module('termios') import errno +import pathlib import pty import os import sys @@ -75,6 +76,14 @@ 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(): + return fun try: tty.tcgetattr(pty.STDIN_FILENO) return unittest.expectedFailure(fun) From 2d45ca14cd24b5ba061b376b14f964a4d26e61de Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Wed, 25 Nov 2020 18:41:19 +0200 Subject: [PATCH 2/2] Add a comment for reason to don't apply expectedFailure() on Gentoo --- Lib/test/test_pty.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 4aff7468a0519a..138560e0309ab0 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -83,6 +83,11 @@ def expectedFailureIfStdinIsTTY(fun): # 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)