diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -215,10 +215,10 @@ class PosixTester(unittest.TestCase): try: posix.mknod(support.TESTFN, stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR, 0) - except OSError: + except OSError as e: # Some old systems don't allow unprivileged users to use # mknod(), or only support creating device nodes. - pass + self.assertIn(e.errno, (errno.EPERM, errno.EINVAL)) else: self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))