handle sched_rr_get_interval not working on current

This commit is contained in:
Benjamin Peterson 2011-08-02 22:19:14 -05:00
parent 50ba271dbb
commit 43234ab685
1 changed files with 8 additions and 1 deletions

View File

@ -890,7 +890,14 @@ class PosixTester(unittest.TestCase):
@unittest.skipUnless(hasattr(posix, "sched_rr_get_interval"), "no function")
def test_sched_rr_get_interval(self):
interval = posix.sched_rr_get_interval(0)
try:
interval = posix.sched_rr_get_interval(0)
except OSError as e:
# This likely means that sched_rr_get_interval is only valid for
# processes with the SCHED_RR scheduler in effect.
if e.errno != errno.EINVAL:
raise
self.skipTest("only works on SCHED_RR processes")
self.assertIsInstance(interval, float)
# Reasonable constraints, I think.
self.assertGreaterEqual(interval, 0.)