From 2d6d4d7402b24255b1a188c891bdaa500d2800df Mon Sep 17 00:00:00 2001 From: AN Long Date: Sat, 16 Mar 2024 20:59:11 +0800 Subject: [PATCH 1/2] gh-104242: Skip test_is_char_device_true in pathlib test on non posix platform --- Lib/test/test_pathlib/test_pathlib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py index 6509c08d227346..47b66caf591012 100644 --- a/Lib/test/test_pathlib/test_pathlib.py +++ b/Lib/test/test_pathlib/test_pathlib.py @@ -1102,6 +1102,7 @@ def test_is_socket_true(self): self.assertIs(self.cls(self.base, 'mysock\udfff').is_socket(), False) self.assertIs(self.cls(self.base, 'mysock\x00').is_socket(), False) + @unittest.skipIf(os.name != 'posix', 'test requires a POSIX-compatible system') def test_is_char_device_true(self): # Under Unix, /dev/null should generally be a char device. P = self.cls('/dev/null') @@ -1575,7 +1576,7 @@ def test_group_windows(self): P('c:/').group() -@unittest.skipIf(os.name == 'nt', 'test requires a POSIX-compatible system') +@unittest.skipIf(os.name != 'posix', 'test requires a POSIX-compatible system') class PosixPathTest(PathTest, PurePosixPathTest): cls = pathlib.PosixPath From 594686f0c603b3bb1290937079de5db9942994a1 Mon Sep 17 00:00:00 2001 From: AN Long Date: Mon, 18 Mar 2024 20:31:21 +0800 Subject: [PATCH 2/2] Update Lib/test/test_pathlib/test_pathlib.py Co-authored-by: Barney Gale --- Lib/test/test_pathlib/test_pathlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py index 47b66caf591012..590f655880d6de 100644 --- a/Lib/test/test_pathlib/test_pathlib.py +++ b/Lib/test/test_pathlib/test_pathlib.py @@ -1102,7 +1102,7 @@ def test_is_socket_true(self): self.assertIs(self.cls(self.base, 'mysock\udfff').is_socket(), False) self.assertIs(self.cls(self.base, 'mysock\x00').is_socket(), False) - @unittest.skipIf(os.name != 'posix', 'test requires a POSIX-compatible system') + @needs_posix def test_is_char_device_true(self): # Under Unix, /dev/null should generally be a char device. P = self.cls('/dev/null')