Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-111912: Run test_posix on Windows #111913

Merged
merged 3 commits into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
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
Expand All @@ -22,6 +19,11 @@
import textwrap
from contextlib import contextmanager

try:
import posix
except ImportError:
import nt as posix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little bit surprising, but well, it's convenient for these tests :-)

The C extension should be called _os instead of posix or nt :-(


try:
import pwd
except ImportError:
Expand Down Expand Up @@ -1009,6 +1011,7 @@ def test_environ(self):
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')
Expand Down Expand Up @@ -1220,6 +1223,7 @@ def test_sched_setaffinity(self):
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
Expand Down
Loading