]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41818: test_openpty succeed on Gentoo, don't expect to fail on this platform...
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Wed, 25 Nov 2020 17:06:12 +0000 (19:06 +0200)
committerGitHub <noreply@github.com>
Wed, 25 Nov 2020 17:06:12 +0000 (19:06 +0200)
Lib/test/test_pty.py

index 7de568806ed7d88bc6658959cde31739bccad8ce..138560e0309ab055c06fd48f3c3853d6d5f08a45 100644 (file)
@@ -5,6 +5,7 @@ from test.support.import_helper import import_module
 import_module('termios')
 
 import errno
+import pathlib
 import pty
 import os
 import sys
@@ -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)