Skip to content

Commit 64fea32

Browse files
gh-111912: Run test_posix on Windows (GH-111913)
1 parent 65d6dc2 commit 64fea32

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test_posix.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
from test.support import warnings_helper
77
from test.support.script_helper import assert_python_ok
88

9-
# Skip these tests if there is no posix module.
10-
posix = import_helper.import_module('posix')
11-
129
import errno
1310
import sys
1411
import signal
@@ -22,6 +19,11 @@
2219
import textwrap
2320
from contextlib import contextmanager
2421

22+
try:
23+
import posix
24+
except ImportError:
25+
import nt as posix
26+
2527
try:
2628
import pwd
2729
except ImportError:
@@ -1009,6 +1011,7 @@ def test_environ(self):
10091011
self.assertEqual(type(k), item_type)
10101012
self.assertEqual(type(v), item_type)
10111013

1014+
@unittest.skipUnless(os.name == 'posix', "see bug gh-111841")
10121015
def test_putenv(self):
10131016
with self.assertRaises(ValueError):
10141017
os.putenv('FRUIT\0VEGETABLE', 'cabbage')
@@ -1220,6 +1223,7 @@ def test_sched_setaffinity(self):
12201223
self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)
12211224

12221225
@unittest.skipIf(support.is_wasi, "No dynamic linking on WASI")
1226+
@unittest.skipUnless(os.name == 'posix', "POSIX-only test")
12231227
def test_rtld_constants(self):
12241228
# check presence of major RTLD_* constants
12251229
posix.RTLD_LAZY

0 commit comments

Comments
 (0)