Skip to content
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
16 changes: 10 additions & 6 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,15 +1659,17 @@ def test_setsigdef_wrong_type(self):
os.environ, setsigdef=[signal.NSIG, signal.NSIG+1])

@requires_sched
@unittest.skipIf(sys.platform.startswith(('freebsd', 'netbsd')),
"bpo-34685: test can fail on BSD")
def test_setscheduler_only_param(self):
policy = os.sched_getscheduler(0)
priority = os.sched_get_priority_min(policy)
code = textwrap.dedent(f"""\
import os
import os, sys
if os.sched_getscheduler(0) != {policy}:
os.exit(101)
sys.exit(101)
if os.sched_getparam(0).sched_priority != {priority}:
os.exit(102)""")
sys.exit(102)""")
pid = posix.posix_spawn(
sys.executable,
[sys.executable, '-c', code],
Expand All @@ -1677,15 +1679,17 @@ def test_setscheduler_only_param(self):
self.assertEqual(os.waitpid(pid, 0), (pid, 0))

@requires_sched
@unittest.skipIf(sys.platform.startswith(('freebsd', 'netbsd')),
"bpo-34685: test can fail on BSD")
def test_setscheduler_with_policy(self):
policy = os.sched_getscheduler(0)
priority = os.sched_get_priority_min(policy)
code = textwrap.dedent(f"""\
import os
import os, sys
if os.sched_getscheduler(0) != {policy}:
os.exit(101)
sys.exit(101)
if os.sched_getparam(0).sched_priority != {priority}:
os.exit(102)""")
sys.exit(102)""")
pid = posix.posix_spawn(
sys.executable,
[sys.executable, '-c', code],
Expand Down