nikademus79 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

use df -P in test/_linux.py #192

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
df can split lines if the device name is too long

$ df -B 1
Filesystem           1B-blocks      Used Available Use% Mounted on
/dev/mapper/system-root
                     12874416128 10201149440 2673266688  80% /

and that would cause the test/_linux.py test_disks to fail with:

======================================================================
ERROR: test_disks (__main__.LinuxSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/_linux.py", line 54, in test_disks
    dev, total, used, free = df(part.mountpoint)
  File "test/_linux.py", line 46, in df
    dev, total, used, free = line.split()[:4]
ValueError: need more than 1 value to unpack

----------------------------------------------------------------------

just use 'df -P -B 1" to have the posix output for df and it works fine.

Original issue reported on code.google.com by matrixhasu on 3 Aug 2011 at 2:56

GoogleCodeExporter commented 8 years ago
Fixed in r1108. Thanks.

Original comment by g.rodola on 4 Aug 2011 at 8:56

GoogleCodeExporter commented 8 years ago

Original comment by g.rodola on 16 Sep 2011 at 3:34

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Updated csets after the SVN -> Mercurial migration:
r1108 == revision 03a2d22537a2

Original comment by g.rodola on 2 Mar 2013 at 12:02