summaryrefslogtreecommitdiff
path: root/psutil/tests/test_linux.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2018-10-19 14:27:56 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2018-10-19 14:27:56 +0200
commitfbece8e45991e8cc070bfd5e9efcd4974227abcd (patch)
tree043ad8d23109a3c27d52349626f83c004d378498 /psutil/tests/test_linux.py
parent6db8d2e41dc67621eae9d8eeab3c39fef7e2ddf4 (diff)
downloadpsutil-fbece8e45991e8cc070bfd5e9efcd4974227abcd.tar.gz
fix #1307: [Linux] disk_partitions() does not honour PROCFS_PATH
Diffstat (limited to 'psutil/tests/test_linux.py')
-rwxr-xr-xpsutil/tests/test_linux.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 115a6af8..4b72f725 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -1011,6 +1011,18 @@ class TestSystemDisks(unittest.TestCase):
assert ret
self.assertEqual(ret[0].fstype, 'zfs')
+ def test_disk_partitions_procfs(self):
+ # See: https://github.com/giampaolo/psutil/issues/1307
+ try:
+ with mock.patch('os.path.realpath',
+ return_value='/non/existent') as m:
+ with self.assertRaises(OSError) as cm:
+ psutil.disk_partitions()
+ assert m.called
+ self.assertEqual(cm.exception.errno, errno.ENOENT)
+ finally:
+ psutil.PROCFS_PATH = "/proc"
+
def test_disk_io_counters_kernel_2_4_mocked(self):
# Tests /proc/diskstats parsing format for 2.4 kernels, see:
# https://github.com/giampaolo/psutil/issues/767