diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-05 18:51:26 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-05 18:51:26 +0200 |
commit | fa3a646a597a760283470757fde2c4a3bb98bbab (patch) | |
tree | 56c6cf89db594cce34e812719d25d4b245a21e87 | |
parent | a79ab08c3910f73ee17877ef7a2784de4706e55b (diff) | |
download | psutil-fa3a646a597a760283470757fde2c4a3bb98bbab.tar.gz |
small test refactoring
-rwxr-xr-x | psutil/tests/test_system.py | 8 |
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 |