summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-04-05 16:26:07 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2019-04-05 16:26:07 +0200
commit3f67688df6c47eec3427c001ef1f11b14e6fcaf2 (patch)
tree3bbad542cac7d1d6b2aca71084f0aa6b5addce08
parent275df44b5798ddf09485d7ad503a212636ddf340 (diff)
downloadpsutil-fix-tests.tar.gz
fix linux testsfix-tests
-rw-r--r--psutil/__init__.py2
-rw-r--r--psutil/_pslinux.py4
-rwxr-xr-xpsutil/tests/test_process.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py
index a217a9e7..90066f39 100644
--- a/psutil/__init__.py
+++ b/psutil/__init__.py
@@ -2489,7 +2489,7 @@ def test(): # pragma: no cover
p.info['memory_info'] is not None else ''
rss = bytes2human(p.info['memory_info'].rss) if \
p.info['memory_info'] is not None else ''
- memp = round(p.info['memory_percent']) if \
+ memp = round(p.info['memory_percent'], 1) if \
p.info['memory_percent'] is not None else ''
print(templ % (
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 6c58cf2c..bf815e87 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1988,8 +1988,8 @@ class Process(object):
def ionice_set(self, ioclass, value):
if value is None:
value = 0
- if value and ioclass == IOPRIO_CLASS_IDLE:
- raise ValueError("IOPRIO_CLASS_IDLE accepts no value")
+ if value and ioclass in (IOPRIO_CLASS_IDLE, IOPRIO_CLASS_NONE):
+ raise ValueError("%r ioclass accepts no value" % ioclass)
if value < 0 or value > 7:
raise ValueError("value not in 0-7 range")
return cext.proc_ioprio_set(self.pid, ioclass, value)
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index 25c70a25..a4b738ee 100755
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -382,10 +382,10 @@ class TestProcess(unittest.TestCase):
p.ionice(psutil.IOPRIO_CLASS_IDLE, value=8)
# errs
self.assertRaisesRegex(
- ValueError, "can't specify value with IOPRIO_CLASS_NONE",
+ ValueError, "ioclass accepts no value",
p.ionice, psutil.IOPRIO_CLASS_NONE, 1)
self.assertRaisesRegex(
- ValueError, "can't specify value with IOPRIO_CLASS_IDLE",
+ ValueError, "ioclass accepts no value",
p.ionice, psutil.IOPRIO_CLASS_IDLE, 1)
self.assertRaisesRegex(
ValueError, "'ioclass' argument must be specified",