summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-01-24 16:50:23 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2017-01-24 16:50:23 +0100
commit1389d031809f82226fc139f32e6bc938d5372a38 (patch)
tree6be0a31b86538d4baa761ff1b1b554597f614ba1
parent232b6910b0c14ff2c91da44f39bc20158b68e999 (diff)
downloadpsutil-1389d031809f82226fc139f32e6bc938d5372a38.tar.gz
memleaks test: add test to grant coverage of all Process methods
-rwxr-xr-xpsutil/tests/test_memory_leaks.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/psutil/tests/test_memory_leaks.py b/psutil/tests/test_memory_leaks.py
index 6f724339..7b60409e 100755
--- a/psutil/tests/test_memory_leaks.py
+++ b/psutil/tests/test_memory_leaks.py
@@ -179,6 +179,19 @@ class TestProcessObjectLeaks(TestMemLeak):
proc = thisproc
+ def test_coverage(self):
+ skip = set((
+ "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"))
+ for name in dir(psutil.Process):
+ if name.startswith('_'):
+ continue
+ if name in skip:
+ continue
+ self.assertTrue(hasattr(self, "test_" + name), msg=name)
+
@skip_if_linux()
def test_name(self):
self.execute(self.proc.name)
@@ -259,6 +272,10 @@ class TestProcessObjectLeaks(TestMemLeak):
self.execute(self.proc.num_fds)
@skip_if_linux()
+ def test_num_ctx_switches(self):
+ self.execute(self.proc.num_ctx_switches)
+
+ @skip_if_linux()
def test_threads(self):
self.execute(self.proc.threads)