test-runner: handle pyroute2 IW() between versions

It appears different versions of pyroute2 may or may not have
iwutil, and instead use pyroute2.IW() directly. Try the iwutil
way first, then pyroute2.IW()
This commit is contained in:
James Prestwood 2021-10-28 10:34:09 -07:00 committed by Denis Kenzior
parent 4d66e11b0c
commit 89407089cd
1 changed files with 5 additions and 1 deletions

View File

@ -853,7 +853,11 @@ class TestContext(Namespace):
def discover_radios(self):
phys = []
iw = pyroute2.iwutil.IW()
try:
iw = pyroute2.iwutil.IW()
except:
iw = pyroute2.IW()
attrs = [phy['attrs'] for phy in iw.list_wiphy()]