gh-139935: do not skip test on real errors in os.getlogin (#139953)

This commit is contained in:
Bénédikt Tran
2025-10-11 16:31:34 +02:00
committed by GitHub
parent 897a36badd
commit 2eb32add92

View 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