Skip to content

Commit 3d18b50

Browse files
authored
bpo-34685: Skip posix_spawn scheduler tests on BSD (GH-9316)
* Skip posix_spawn scheduler tests on BSD. We were already skyping similar tests as the behaviour can depend on the implementation in some cases.
1 parent 7372c3b commit 3d18b50

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Lib/test/test_posix.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,15 +1659,17 @@ def test_setsigdef_wrong_type(self):
16591659
os.environ, setsigdef=[signal.NSIG, signal.NSIG+1])
16601660

16611661
@requires_sched
1662+
@unittest.skipIf(sys.platform.startswith(('freebsd', 'netbsd')),
1663+
"bpo-34685: test can fail on BSD")
16621664
def test_setscheduler_only_param(self):
16631665
policy = os.sched_getscheduler(0)
16641666
priority = os.sched_get_priority_min(policy)
16651667
code = textwrap.dedent(f"""\
1666-
import os
1668+
import os, sys
16671669
if os.sched_getscheduler(0) != {policy}:
1668-
os.exit(101)
1670+
sys.exit(101)
16691671
if os.sched_getparam(0).sched_priority != {priority}:
1670-
os.exit(102)""")
1672+
sys.exit(102)""")
16711673
pid = posix.posix_spawn(
16721674
sys.executable,
16731675
[sys.executable, '-c', code],
@@ -1677,15 +1679,17 @@ def test_setscheduler_only_param(self):
16771679
self.assertEqual(os.waitpid(pid, 0), (pid, 0))
16781680

16791681
@requires_sched
1682+
@unittest.skipIf(sys.platform.startswith(('freebsd', 'netbsd')),
1683+
"bpo-34685: test can fail on BSD")
16801684
def test_setscheduler_with_policy(self):
16811685
policy = os.sched_getscheduler(0)
16821686
priority = os.sched_get_priority_min(policy)
16831687
code = textwrap.dedent(f"""\
1684-
import os
1688+
import os, sys
16851689
if os.sched_getscheduler(0) != {policy}:
1686-
os.exit(101)
1690+
sys.exit(101)
16871691
if os.sched_getparam(0).sched_priority != {priority}:
1688-
os.exit(102)""")
1692+
sys.exit(102)""")
16891693
pid = posix.posix_spawn(
16901694
sys.executable,
16911695
[sys.executable, '-c', code],

0 commit comments

Comments
 (0)