diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-10-02 12:40:09 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-10-02 12:40:09 +0200 |
commit | ecd0c61d668d57c237265ee44c20a2e10500191c (patch) | |
tree | 0a1815fbd36b495b9fde94cb69f9664d1c427eac | |
parent | ce5cb8c8917305ce7d63de408d28daadd0302ec4 (diff) | |
download | psutil-ecd0c61d668d57c237265ee44c20a2e10500191c.tar.gz |
refactoring
-rw-r--r-- | psutil/tests/__init__.py | 7 | ||||
-rw-r--r-- | psutil/tests/test_linux.py | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index b75ab0b4..0d646650 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -459,14 +459,13 @@ def safe_rmpath(path): "Convenience function for removing temporary test files or dirs" try: st = os.stat(path) - except OSError as err: - if err.errno != errno.ENOENT: - raise - else: if stat.S_ISDIR(st.st_mode): os.rmdir(path) else: os.remove(path) + except OSError as err: + if err.errno != errno.ENOENT: + raise @contextlib.contextmanager diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index 469cb6c7..703a9731 100644 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -268,7 +268,7 @@ class TestSystemVirtualMemory(unittest.TestCase): def test_avail_old_percent(self): # Make sure that our calculation of avail mem for old kernels - # is off by max 2%. + # is off by max 5%. from psutil._pslinux import calculate_avail_vmem from psutil._pslinux import open_binary @@ -282,7 +282,7 @@ class TestSystemVirtualMemory(unittest.TestCase): if b'MemAvailable:' in mems: b = mems[b'MemAvailable:'] diff_percent = abs(a - b) / a * 100 - self.assertLess(diff_percent, 2) + self.assertLess(diff_percent, 5) def test_avail_old_comes_from_kernel(self): # Make sure "MemAvailable:" coluimn is used instead of relying |