From 470dfe20cb6e741c42c52619e122fc218e27aebd Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 3 Apr 2022 12:27:32 -0700 Subject: [PATCH] bpo-47205: Skip error check of sched_get/setaffinity on FreeBSD (GH-32285) (cherry picked from commit b82cdd1dac9a9be52051abd90a1ce69236ac41f4) Co-authored-by: Christian Heimes --- Lib/test/test_posix.py | 8 ++++++-- .../next/Tests/2022-04-03-14-38-21.bpo-47205.hbbTnh.rst | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2022-04-03-14-38-21.bpo-47205.hbbTnh.rst diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 974edd766cc8..701543bb6ac6 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1179,7 +1179,9 @@ class PosixTester(unittest.TestCase): mask = posix.sched_getaffinity(0) self.assertIsInstance(mask, set) self.assertGreaterEqual(len(mask), 1) - self.assertRaises(OSError, posix.sched_getaffinity, -1) + if not sys.platform.startswith("freebsd"): + # bpo-47205: does not raise OSError on FreeBSD + self.assertRaises(OSError, posix.sched_getaffinity, -1) for cpu in mask: self.assertIsInstance(cpu, int) self.assertGreaterEqual(cpu, 0) @@ -1197,7 +1199,9 @@ class PosixTester(unittest.TestCase): self.assertRaises(ValueError, posix.sched_setaffinity, 0, [-10]) self.assertRaises(ValueError, posix.sched_setaffinity, 0, map(int, "0X")) self.assertRaises(OverflowError, posix.sched_setaffinity, 0, [1<<128]) - self.assertRaises(OSError, posix.sched_setaffinity, -1, mask) + if not sys.platform.startswith("freebsd"): + # bpo-47205: does not raise OSError on FreeBSD + self.assertRaises(OSError, posix.sched_setaffinity, -1, mask) def test_rtld_constants(self): # check presence of major RTLD_* constants diff --git a/Misc/NEWS.d/next/Tests/2022-04-03-14-38-21.bpo-47205.hbbTnh.rst b/Misc/NEWS.d/next/Tests/2022-04-03-14-38-21.bpo-47205.hbbTnh.rst new file mode 100644 index 000000000000..35fd94421326 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-04-03-14-38-21.bpo-47205.hbbTnh.rst @@ -0,0 +1,2 @@ +Skip test for :func:`~os.sched_getaffinity` and +:func:`~os.sched_setaffinity` error case on FreeBSD. -- 2.47.3