diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -115,6 +115,25 @@ Structure = object c_int = c_double = None + +def check_enough_semaphores(): + """Check that the system supports enough semaphores to run the test.""" + try: + nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") + except (AttributeError, ValueError): + # sysconf not available or setting not available + return + if nsems_max == -1: + # indetermine limit, assume that limit is determined by available memory + # only + return + if nsems_max >= 256: + # minimum number of semaphores available according to POSIX + return + raise unittest.SkipTest("The OS doesn't support enough semaphores " + "to run the test.") + + # # Creates a wrapper for a function which records the time it takes to finish # @@ -2349,6 +2368,8 @@ except OSError: raise unittest.SkipTest("OSError raises on RLock creation, see issue 3111!") + check_enough_semaphores() + if run is None: from test.support import run_unittest as run