[Python-checkins] bpo-47205: Skip error check of sched_get/setaffinity on FreeBSD (GH-32285)

tiran webhook-mailer at python.org
Sun Apr 3 11:04:16 EDT 2022


https://github.com/python/cpython/commit/b82cdd1dac9a9be52051abd90a1ce69236ac41f4
commit: b82cdd1dac9a9be52051abd90a1ce69236ac41f4
branch: main
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2022-04-03T17:03:49+02:00
summary:

bpo-47205: Skip error check of sched_get/setaffinity on FreeBSD (GH-32285)

files:
A Misc/NEWS.d/next/Tests/2022-04-03-14-38-21.bpo-47205.hbbTnh.rst
M Lib/test/test_posix.py

diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index c10039b17f7f8..f44b8d0403ff2 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1194,7 +1194,9 @@ def test_sched_getaffinity(self):
         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)
@@ -1212,7 +1214,9 @@ def test_sched_setaffinity(self):
         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 0000000000000..35fd94421326e
--- /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.



More information about the Python-checkins mailing list