mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
da3f66ea68
There is a very common block of code inside many autotests which goes something like: device.scan() condition = 'obj.scanning' wd.wait_for_object_condition(device, condition) condition = 'not obj.scanning' wd.wait_for_object_condition(device, condition) network = device.get_ordered_network('an-ssid') When you see the same pattern in nearly all the tests this shows we need a helper. Basic autotests which merely check that a connection succeeded should not need to write the same code again and again. This code ends up being copy-pasted which can lead to bugs. There is also a code pattern which attempts to get ordered networks, and if this fails it scans and tries again. This, while not optimal, does prevent unneeded scanning by first checking if any networks already exist. This patch solves both the code reuse issue as well as the recovery if get_ordered_network(s) fails. A new optional parameter was added to get_ordered_network(s) which is False by default. If True get_ordered_network(s) will perform a scan if the initial call yields no networks. Tests will now be able to simply call get_ordered_network(s) without performing a scan before hand. |
||
---|---|---|
.. | ||
hlrauc.py | ||
hostapd.py | ||
hwsim.py | ||
iwd.py | ||
ofono.py | ||
testutil.py | ||
wiphy.py |