mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-10-18 07:31:55 +00:00
storage: tests: Fix a failure from psutil change (Closes: #1149418)
Tests: - On unstable container, the test fails before the patch and passes after. - On stable, testing, and unstable containers, unit tests pass. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
49acf4fb5c
commit
6d9ff77e4b
@ -380,17 +380,16 @@ def test_is_partition_read_only(disk_partitions):
|
||||
|
||||
def partition(*args):
|
||||
try:
|
||||
# psutil <= 5.9.8
|
||||
# pylint: disable=protected-access
|
||||
return psutil._common.sdiskpart(*args)
|
||||
except TypeError:
|
||||
# psutil >= 7.0
|
||||
return psutil._common.sdiskpart(*args[:-2])
|
||||
return psutil._common.sdiskpart(*args)
|
||||
except AttributeError:
|
||||
# psutil >= 7.2
|
||||
return psutil._ntuples.sdiskpart(*args)
|
||||
|
||||
disk_partitions.return_value = [
|
||||
partition('/dev/root', '/', 'btrfs', 'rw,nosuid', 42, 42),
|
||||
partition('/dev/root', '/foo', 'btrfs', 'rw', 321, 321),
|
||||
partition('/dev/foo', '/bar', 'extfs', 'ro', 123, 123)
|
||||
partition('/dev/root', '/', 'btrfs', 'rw,nosuid'),
|
||||
partition('/dev/root', '/foo', 'btrfs', 'rw'),
|
||||
partition('/dev/foo', '/bar', 'extfs', 'ro')
|
||||
]
|
||||
assert not storage.is_partition_read_only('/')
|
||||
assert not storage.is_partition_read_only('/foo')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user