Check that the system supports enough semaphores to run the test.
()
| 166 | |
| 167 | |
| 168 | def check_enough_semaphores(): |
| 169 | """Check that the system supports enough semaphores to run the test.""" |
| 170 | # minimum number of semaphores available according to POSIX |
| 171 | nsems_min = 256 |
| 172 | try: |
| 173 | nsems = os.sysconf("SC_SEM_NSEMS_MAX") |
| 174 | except (AttributeError, ValueError): |
| 175 | # sysconf not available or setting not available |
| 176 | return |
| 177 | if nsems == -1 or nsems >= nsems_min: |
| 178 | return |
| 179 | raise unittest.SkipTest("The OS doesn't support enough semaphores " |
| 180 | "to run the test (required: %d)." % nsems_min) |
| 181 | |
| 182 | |
| 183 | def only_run_in_spawn_testsuite(reason): |