Skip to content

Commit

Permalink
make test more verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 1, 2024
1 parent e5d8273 commit 9436011
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions psutil/tests/test_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ def test_emulate_unix(self):

@unittest.skipIf(not LINUX, "LINUX only")
class TestSystemDiskPartitions(PsutilTestCase):
maxDiff = None

@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
@skip_on_not_implemented()
Expand Down Expand Up @@ -1147,9 +1148,8 @@ def df(path):
delta=TOLERANCE_DISK_USAGE)

def test_against_mount(self):
def parse_mount():
def parse_mount(out):
ls = []
out = sh("mount")
for line in out.splitlines():
fields = line.split()
device = fields[0]
Expand All @@ -1159,14 +1159,17 @@ def parse_mount():
ls.append((device, mountpoint, fstype, opts))
return ls

self.assertEqual(
parse_mount(), psutil._psplatform._disk_partitions_mountinfo())
self.assertEqual(
parse_mount(), psutil._psplatform._disk_partitions_getmntent())
self.assertEqual(
parse_mount(),
[tuple(x[:4]) for x in psutil.disk_partitions(all=True)]
)
out = sh("mount")
mount = parse_mount(out)
with self.subTest(mount="\n" + out):
self.assertEqual(
mount, psutil._psplatform._disk_partitions_mountinfo())
self.assertEqual(
mount, psutil._psplatform._disk_partitions_getmntent())
self.assertEqual(
mount,
[tuple(x[:4]) for x in psutil.disk_partitions(all=True)]
)

def test_zfs_fs(self):
# Test that ZFS partitions are returned.
Expand Down

0 comments on commit 9436011

Please sign in to comment.