diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-08-04 09:52:22 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-08-04 09:52:22 +0200 |
commit | d2894afca5dec3f650cf4623cfac746e5b577474 (patch) | |
tree | d6ac26813dfb8c55f2c64b44e44d8f5506f7d2eb | |
parent | 44d37aec3dff113960af5c83ded3f271e9ee57f3 (diff) | |
download | psutil-d2894afca5dec3f650cf4623cfac746e5b577474.tar.gz |
small test refactoring
-rw-r--r-- | psutil/tests/test_bsd.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/psutil/tests/test_bsd.py b/psutil/tests/test_bsd.py index 53f830d3..f6cb43e0 100644 --- a/psutil/tests/test_bsd.py +++ b/psutil/tests/test_bsd.py @@ -149,15 +149,8 @@ class FreeBSDSpecificTestCase(unittest.TestCase): def tearDownClass(cls): reap_children() - def test_boot_time(self): - s = sysctl('sysctl kern.boottime') - s = s[s.find(" sec = ") + 7:] - s = s[:s.find(',')] - btime = int(s) - self.assertEqual(btime, psutil.boot_time()) - @retry_before_failing() - def test_memory_maps(self): + def test_proc_memory_maps(self): out = sh('procstat -v %s' % self.pid) maps = psutil.Process(self.pid).memory_maps(grouped=False) lines = out.split('\n')[1:] @@ -171,17 +164,17 @@ class FreeBSDSpecificTestCase(unittest.TestCase): if not map.path.startswith('['): self.assertEqual(fields[10], map.path) - def test_exe(self): + def test_proc_exe(self): out = sh('procstat -b %s' % self.pid) self.assertEqual(psutil.Process(self.pid).exe(), out.split('\n')[1].split()[-1]) - def test_cmdline(self): + def test_proc_cmdline(self): out = sh('procstat -c %s' % self.pid) self.assertEqual(' '.join(psutil.Process(self.pid).cmdline()), ' '.join(out.split('\n')[1].split()[2:])) - def test_uids_gids(self): + def test_proc_uids_gids(self): out = sh('procstat -s %s' % self.pid) euid, ruid, suid, egid, rgid, sgid = out.split('\n')[1].split()[2:8] p = psutil.Process(self.pid) @@ -301,6 +294,15 @@ class FreeBSDSpecificTestCase(unittest.TestCase): # self.assertAlmostEqual(psutil.cpu_stats().traps, # sysctl('vm.stats.sys.v_trap'), delta=1000) + # --- others + + def test_boot_time(self): + s = sysctl('sysctl kern.boottime') + s = s[s.find(" sec = ") + 7:] + s = s[:s.find(',')] + btime = int(s) + self.assertEqual(btime, psutil.boot_time()) + # ===================================================================== # --- OpenBSD |