summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-15 18:01:15 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-15 18:01:15 +0100
commite85151e70cff9ea4483d249cde12fc74e5dbdc69 (patch)
tree48a0c2f60ca92f10792ffb9d83101b2c66c2752f
parent50fd31a4eaca3e24905b96d587fd08bcf313fc6b (diff)
downloadpsutil-e85151e70cff9ea4483d249cde12fc74e5dbdc69.tar.gz
free: add err check
-rw-r--r--psutil/tests/test_linux.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 4ade173c..561b2635 100644
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -96,7 +96,9 @@ def free_swap():
for line in lines:
if line.startswith('Swap'):
_, total, used, free = line.split()
- return (int(total) * 1024, int(used) * 1024, int(free) * 1024)
+ return (int(total) * 1024, int(used) * 1024, int(free) * 1024)
+ raise ValueError(
+ "can't find 'Swap' in 'free' output:\n%s" % '\n'.join(lines))
def free_physmem():
@@ -108,7 +110,9 @@ def free_physmem():
if line.startswith('Mem'):
total, used, free, shared, buffers, cached = \
[int(x) * 1024 for x in line.split()[1:]]
- return (total, used, free, shared, buffers, cached)
+ return (total, used, free, shared, buffers, cached)
+ raise ValueError(
+ "can't find 'Mem' in 'free' output:\n%s" % '\n'.join(lines))
# =====================================================================