summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-05 18:51:26 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-05-05 18:51:26 +0200
commitfa3a646a597a760283470757fde2c4a3bb98bbab (patch)
tree56c6cf89db594cce34e812719d25d4b245a21e87
parenta79ab08c3910f73ee17877ef7a2784de4706e55b (diff)
downloadpsutil-fa3a646a597a760283470757fde2c4a3bb98bbab.tar.gz
small test refactoring
-rwxr-xr-xpsutil/tests/test_system.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 6aae894a..32f76f57 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -450,13 +450,9 @@ class TestSystemAPIs(unittest.TestCase):
# if path does not exist OSError ENOENT is expected across
# all platforms
fname = tempfile.mktemp()
- try:
+ with self.assertRaises(OSError) as exc:
psutil.disk_usage(fname)
- except OSError as err:
- if err.errno != errno.ENOENT:
- raise
- else:
- self.fail("OSError not raised")
+ self.assertEqual(exc.exception.errno, errno.ENOENT)
def test_disk_usage_unicode(self):
# See: https://github.com/giampaolo/psutil/issues/416