]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-139935: do not skip test on real errors in `os.getlogin` (#139953)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sat, 11 Oct 2025 14:31:34 +0000 (16:31 +0200)
committerGitHub <noreply@github.com>
Sat, 11 Oct 2025 14:31:34 +0000 (16:31 +0200)
Lib/test/test_os/test_os.py

index 95b175db6fcdcbeda318fed225bfd97678d6d0d5..e074858fe2ad998a034f781c9f4a4e2f549dca0c 100644 (file)
@@ -3204,13 +3204,7 @@ class LoginTests(unittest.TestCase):
             user_name = os.getlogin()
         except OSError as exc:
             # See https://man7.org/linux/man-pages/man3/getlogin.3.html#ERRORS.
-            allowed_errors = (
-                # defined by POSIX
-                errno.EMFILE, errno.ENFILE, errno.ENXIO, errno.ERANGE,
-                # defined by Linux/glibc
-                errno.ENOENT, errno.ENOMEM, errno.ENOTTY,
-            )
-            if exc.errno in allowed_errors:
+            if exc.errno in (errno.ENXIO, errno.ENOENT, errno.ENOTTY):
                 self.skipTest(str(exc))
             else:
                 raise