]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-104242: Enable test_is_char_device_true in pathlib test on all platform...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 27 Mar 2024 08:57:08 +0000 (09:57 +0100)
committerGitHub <noreply@github.com>
Wed, 27 Mar 2024 08:57:08 +0000 (08:57 +0000)
(cherry picked from commit 17a82a1d16a46b6c008240bcc698619419ce5554)
(cherry picked from commit af1b0e94400d1bf732466d675054df8cf7dfb62d)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Lib/test/test_pathlib.py

index bd5170651d534544ebb838dbd8ba5c4f0c076b32..aaa2adea462f42e638fac33a020591ff76ebcaad 100644 (file)
@@ -2430,15 +2430,15 @@ class _BasePathTest(object):
         self.assertIs((P / 'fileA\x00').is_char_device(), False)
 
     def test_is_char_device_true(self):
-        # Under Unix, /dev/null should generally be a char device.
-        P = self.cls('/dev/null')
+        # os.devnull should generally be a char device.
+        P = self.cls(os.devnull)
         if not P.exists():
-            self.skipTest("/dev/null required")
+            self.skipTest("null device required")
         self.assertTrue(P.is_char_device())
         self.assertFalse(P.is_block_device())
         self.assertFalse(P.is_file())
-        self.assertIs(self.cls('/dev/null\udfff').is_char_device(), False)
-        self.assertIs(self.cls('/dev/null\x00').is_char_device(), False)
+        self.assertIs(self.cls(f'{os.devnull}\udfff').is_char_device(), False)
+        self.assertIs(self.cls(f'{os.devnull}\x00').is_char_device(), False)
 
     def test_pickling_common(self):
         p = self.cls(BASE, 'fileA')