diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-08-04 10:04:24 +0200 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-08-04 10:04:24 +0200 |
| commit | 77a5a302bb1ee9a9cd4741dade0f67bf2b2800c3 (patch) | |
| tree | ee80acf0d79ec2273e72c703b96f4298324b790e | |
| parent | a4d16c9d1d99520a557ed84148382ac7d0a8215c (diff) | |
| download | psutil-77a5a302bb1ee9a9cd4741dade0f67bf2b2800c3.tar.gz | |
small test refactoring
| -rw-r--r-- | psutil/tests/test_bsd.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/psutil/tests/test_bsd.py b/psutil/tests/test_bsd.py index 1ff6337a..50c15e17 100644 --- a/psutil/tests/test_bsd.py +++ b/psutil/tests/test_bsd.py @@ -189,6 +189,7 @@ class FreeBSDSpecificTestCase(unittest.TestCase): @retry_before_failing() def test_proc_ctx_switches(self): + tested = [] out = sh('procstat -r %s' % self.pid) p = psutil.Process(self.pid) for line in out.split('\n'): @@ -197,10 +198,14 @@ class FreeBSDSpecificTestCase(unittest.TestCase): pstat_value = int(line.split()[-1]) psutil_value = p.num_ctx_switches().voluntary self.assertEqual(pstat_value, psutil_value) + tested.append(None) elif ' involuntary context' in line: pstat_value = int(line.split()[-1]) psutil_value = p.num_ctx_switches().voluntary self.assertEqual(pstat_value, psutil_value) + tested.append(None) + if len(tested) != 2: + raise RuntimeError("couldn't find lines match in procstat out") # --- virtual_memory(); tests against sysctl |
