summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2011-02-28 19:27:16 +0000
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2011-02-28 19:27:16 +0000
commitcfbcec3823892759017c1f3a1d1cb7fab4e84f69 (patch)
treea79cffc95c372e9e00ec9d16a450b53726a9fe8a
parent396ff060519a8e7cda872df92f70578d3913921a (diff)
downloadcpython-git-cfbcec3823892759017c1f3a1d1cb7fab4e84f69.tar.gz
Issue 11348: skip os.setpriority() test if current nice level is >= 19.
-rw-r--r--Lib/test/test_os.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index e76f0a0b2b..22e6c5152d 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1274,10 +1274,16 @@ class ProgramPriorityTests(unittest.TestCase):
"""Tests for os.getpriority() and os.setpriority()."""
def test_set_get_priority(self):
+
base = os.getpriority(os.PRIO_PROCESS, os.getpid())
os.setpriority(os.PRIO_PROCESS, os.getpid(), base + 1)
try:
- self.assertEqual(os.getpriority(os.PRIO_PROCESS, os.getpid()), base + 1)
+ new_prio = os.getpriority(os.PRIO_PROCESS, os.getpid())
+ if base >= 19 and new_prio <= 19:
+ raise unittest.SkipTest(
+ "unable to reliably test setpriority at current nice level of %s" % base)
+ else:
+ self.assertEqual(new_prio, base + 1)
finally:
try:
os.setpriority(os.PRIO_PROCESS, os.getpid(), base)