]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111912: Run test_posix on Windows (GH-111913)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 10 Nov 2023 13:29:15 +0000 (15:29 +0200)
committerGitHub <noreply@github.com>
Fri, 10 Nov 2023 13:29:15 +0000 (13:29 +0000)
Lib/test/test_posix.py

index 9d72dba159c6bee537636bcbfa241f2dcde8eb4a..7440779d7200dd351ae6ed1a50e51acc49409bda 100644 (file)
@@ -6,9 +6,6 @@ from test.support import os_helper
 from test.support import warnings_helper
 from test.support.script_helper import assert_python_ok
 
-# Skip these tests if there is no posix module.
-posix = import_helper.import_module('posix')
-
 import errno
 import sys
 import signal
@@ -22,6 +19,11 @@ import warnings
 import textwrap
 from contextlib import contextmanager
 
+try:
+    import posix
+except ImportError:
+    import nt as posix
+
 try:
     import pwd
 except ImportError:
@@ -1009,6 +1011,7 @@ class PosixTester(unittest.TestCase):
             self.assertEqual(type(k), item_type)
             self.assertEqual(type(v), item_type)
 
+    @unittest.skipUnless(os.name == 'posix', "see bug gh-111841")
     def test_putenv(self):
         with self.assertRaises(ValueError):
             os.putenv('FRUIT\0VEGETABLE', 'cabbage')
@@ -1220,6 +1223,7 @@ class PosixTester(unittest.TestCase):
             self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)
 
     @unittest.skipIf(support.is_wasi, "No dynamic linking on WASI")
+    @unittest.skipUnless(os.name == 'posix', "POSIX-only test")
     def test_rtld_constants(self):
         # check presence of major RTLD_* constants
         posix.RTLD_LAZY