From ae1639e1becceec2af11cca7266e0e5607dbc98c Mon Sep 17 00:00:00 2001 From: An Long Date: Wed, 24 Jun 2026 00:58:23 +0900 Subject: [PATCH 1/2] Re-raise unexpected exceptions instead of swallowing them in tests --- Lib/test/test_fcntl.py | 1 + Lib/test/test_pathlib/test_pathlib.py | 1 + Lib/test/test_socket.py | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py index 222b69a6d250cd3..f20a9d407670a9c 100644 --- a/Lib/test/test_fcntl.py +++ b/Lib/test/test_fcntl.py @@ -151,6 +151,7 @@ def test_fcntl_64_bit(self): except OSError as exc: if exc.errno == errno.EINVAL: self.skipTest("F_NOTIFY not available by this environment") + raise fcntl.fcntl(fd, cmd, flags) finally: os.close(fd) diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py index 2cb4876f5c6400a..aff66c8efedbbc0 100644 --- a/Lib/test/test_pathlib/test_pathlib.py +++ b/Lib/test/test_pathlib/test_pathlib.py @@ -2870,6 +2870,7 @@ def test_is_socket_true(self): if (isinstance(e, PermissionError) or "AF_UNIX path too long" in str(e)): self.skipTest("cannot bind Unix socket: " + str(e)) + raise self.assertTrue(P.is_socket()) self.assertFalse(P.is_fifo()) self.assertFalse(P.is_file()) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 63c465e3bfea16d..542d97e3f886e24 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1427,6 +1427,7 @@ def testIPv6toString(self): except OSError as e: if e.winerror == 10022: self.skipTest('IPv6 might not be supported') + raise f = lambda a: inet_pton(AF_INET6, a) assertInvalid = lambda a: self.assertRaises( @@ -1517,6 +1518,7 @@ def testStringToIPv6(self): except OSError as e: if e.winerror == 10022: self.skipTest('IPv6 might not be supported') + raise f = lambda a: inet_ntop(AF_INET6, a) assertInvalid = lambda a: self.assertRaises( From 2c2f096d569304073d308b221a11ed156de36fd3 Mon Sep 17 00:00:00 2001 From: An Long Date: Wed, 24 Jun 2026 01:46:53 +0900 Subject: [PATCH 2/2] Re-raise unexpected exceptions in test_launcher's test_search_major_2 Co-authored-by: Stan Ulbrych --- Lib/test/test_launcher.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_launcher.py b/Lib/test/test_launcher.py index c522bc1c2c093c7..795890bd7e4b473 100644 --- a/Lib/test/test_launcher.py +++ b/Lib/test/test_launcher.py @@ -469,6 +469,7 @@ def test_search_major_2(self): except subprocess.CalledProcessError: if not is_installed("2.7"): raise unittest.SkipTest("requires at least one Python 2.x install") + raise self.assertEqual("PythonCore", data["env.company"]) self.assertStartsWith(data["env.tag"], "2.")