summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-01-24 16:58:30 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2017-01-24 16:58:30 +0100
commitf61e0024d73bf8a65deb44225bcd197daee21a66 (patch)
treebf054b70cca2febbf698a0a74a65ad7f4efc3afe
parent1389d031809f82226fc139f32e6bc938d5372a38 (diff)
downloadpsutil-f61e0024d73bf8a65deb44225bcd197daee21a66.tar.gz
memleaks test: add test to grant coverage of all psutil system functions
-rwxr-xr-xpsutil/tests/test_memory_leaks.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/psutil/tests/test_memory_leaks.py b/psutil/tests/test_memory_leaks.py
index 7b60409e..44be1ec5 100755
--- a/psutil/tests/test_memory_leaks.py
+++ b/psutil/tests/test_memory_leaks.py
@@ -184,7 +184,7 @@ class TestProcessObjectLeaks(TestMemLeak):
"pid", "as_dict", "children", "cpu_affinity", "cpu_percent",
"ionice", "is_running", "kill", "memory_info_ex", "memory_percent",
"nice", "oneshot", "parent", "rlimit", "send_signal", "suspend",
- "suspend", "terminate", "wait"))
+ "terminate", "wait"))
for name in dir(psutil.Process):
if name.startswith('_'):
continue
@@ -460,6 +460,17 @@ class TestTerminatedProcessLeaks(TestProcessObjectLeaks):
class TestModuleFunctionsLeaks(TestMemLeak):
"""Test leaks of psutil module functions."""
+ def test_coverage(self):
+ skip = set((
+ "version_info", "__version__", "process_iter", "wait_procs",
+ "cpu_percent", "cpu_times_percent", "cpu_count"))
+ for name in psutil.__all__:
+ if not name.islower():
+ continue
+ if name in skip:
+ continue
+ self.assertTrue(hasattr(self, "test_" + name), msg=name)
+
# --- cpu
@skip_if_linux()
@@ -518,6 +529,12 @@ class TestModuleFunctionsLeaks(TestMemLeak):
def test_disk_io_counters(self):
self.execute(psutil.disk_io_counters)
+ # --- proc
+
+ @skip_if_linux()
+ def test_pids(self):
+ self.execute(psutil.pids)
+
# --- net
@skip_if_linux()