summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-11-10 13:29:15 (GMT)
committerGitHub <noreply@github.com>2023-11-10 13:29:15 (GMT)
commit64fea3211d08082236d05c38ee728f922eb7d8ed (patch)
treef44ff4682253f0042df5bfd8ef3614596172f3fc
parent65d6dc27156112ac6a9f722b7b62529c94e0344b (diff)
downloadcpython-64fea3211d08082236d05c38ee728f922eb7d8ed.zip
cpython-64fea3211d08082236d05c38ee728f922eb7d8ed.tar.gz
cpython-64fea3211d08082236d05c38ee728f922eb7d8ed.tar.bz2
gh-111912: Run test_posix on Windows (GH-111913)
-rw-r--r--Lib/test/test_posix.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 9d72dba..7440779 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -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
@@ -23,6 +20,11 @@ import textwrap
from contextlib import contextmanager
try:
+ import posix
+except ImportError:
+ import nt as posix
+
+try:
import pwd
except ImportError:
pwd = None
@@ -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