mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-02-04 17:40:31 +01:00
linux: Fix broken assertDevs() device loop
The test uses a generator to get the list of basenames for the devices:
names = (n.split('/')[-1] for n in devs)
Unfortunately, using that "names" varible will consume the generator,
and our array will be lost.
When passing a device dictionary, this code:
print(sorted(names))
print(sorted(names))
will yield:
['battery_hidpp_battery_0']
[]
Save the sorted array, and use that to test for properties equality.
This commit is contained in:
parent
a5acbad7f1
commit
32e2cd5eb9
1 changed files with 2 additions and 2 deletions
|
|
@ -285,9 +285,9 @@ class Tests(dbusmock.DBusTestCase):
|
|||
|
||||
def assertDevs(self, expected):
|
||||
devs = self.proxy.EnumerateDevices()
|
||||
names = (n.split('/')[-1] for n in devs)
|
||||
names = sorted(n.split('/')[-1] for n in devs)
|
||||
|
||||
self.assertEqual(sorted(names), sorted(expected.keys()))
|
||||
self.assertEqual(names, sorted(expected.keys()))
|
||||
|
||||
for n in names:
|
||||
props = self.get_dbus_dev_properties(n)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue