summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2011-02-28 19:27:16 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2011-02-28 19:27:16 (GMT)
commitcfbcec3823892759017c1f3a1d1cb7fab4e84f69 (patch)
treea79cffc95c372e9e00ec9d16a450b53726a9fe8a /Lib/test/test_os.py
parent396ff060519a8e7cda872df92f70578d3913921a (diff)
downloadcpython-cfbcec3823892759017c1f3a1d1cb7fab4e84f69.zip
cpython-cfbcec3823892759017c1f3a1d1cb7fab4e84f69.tar.gz
cpython-cfbcec3823892759017c1f3a1d1cb7fab4e84f69.tar.bz2
Issue 11348: skip os.setpriority() test if current nice level is >= 19.
Diffstat (limited to 'Lib/test/test_os.py')
-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 e76f0a0..22e6c51 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)