mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
auto-t: iwd.py: make scan_if_needed True by default
There is a common block of code in nearly every test which is incorrect, most likely a copy-paste from long ago. It goes something like: wd.wait_for_object_condition(device, 'not obj.scanning') device.scan() wd.wait_for_object_condition(device, 'not obj.scanning') network = device.get_ordered_network("ssid") The problem here is that sometimes the scanning property does not get updated fast enough before device.scan() returns, meaning get_ordered_network comes up with nothing. Some tests pass scan_if_needed=True which 'fixes' this but ends up re-scanning after the original scan finishes. To put this to rest scan_if_needed is now defaulted to True, and no explicit scan should be needed.
This commit is contained in:
parent
4f5010f69d
commit
5519faecba
@ -410,7 +410,7 @@ class Device(IWDDBusAbstract):
|
||||
|
||||
self._wait_for_async_op()
|
||||
|
||||
def get_ordered_networks(self, scan_if_needed = False):
|
||||
def get_ordered_networks(self, scan_if_needed = True):
|
||||
'''Return the list of networks found in the most recent
|
||||
scan, sorted by their user interface importance
|
||||
score as calculated by iwd. If the device is
|
||||
@ -432,7 +432,13 @@ class Device(IWDDBusAbstract):
|
||||
elif not scan_if_needed:
|
||||
return None
|
||||
|
||||
self.scan()
|
||||
condition = 'not obj.scanning'
|
||||
IWD._wait_for_object_condition(self, condition)
|
||||
|
||||
try:
|
||||
self.scan()
|
||||
except InProgressEx:
|
||||
pass
|
||||
|
||||
condition = 'obj.scanning'
|
||||
IWD._wait_for_object_condition(self, condition)
|
||||
@ -448,7 +454,7 @@ class Device(IWDDBusAbstract):
|
||||
|
||||
return None
|
||||
|
||||
def get_ordered_network(self, network, scan_if_needed = False):
|
||||
def get_ordered_network(self, network, scan_if_needed = True):
|
||||
'''Returns a single network from ordered network call, or None if the
|
||||
network wasn't found. If the network is not found an exception is
|
||||
raised, this removes the need to extra asserts in autotests.
|
||||
|
Loading…
Reference in New Issue
Block a user