mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
test-runner: remove path_exists/find_binary
These are already implemented in the shutil module
This commit is contained in:
parent
c74ac94c31
commit
b731e121c9
@ -57,28 +57,6 @@ def exit_vm():
|
|||||||
|
|
||||||
runner.stop()
|
runner.stop()
|
||||||
|
|
||||||
def path_exists(path):
|
|
||||||
'''
|
|
||||||
Searches PATH as well as absolute paths.
|
|
||||||
'''
|
|
||||||
if shutil.which(path):
|
|
||||||
return True
|
|
||||||
try:
|
|
||||||
os.stat(path)
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def find_binary(list):
|
|
||||||
'''
|
|
||||||
Returns a binary from 'list' if its found in PATH or on a
|
|
||||||
valid absolute path.
|
|
||||||
'''
|
|
||||||
for path in list:
|
|
||||||
if path_exists(path):
|
|
||||||
return path
|
|
||||||
return None
|
|
||||||
|
|
||||||
class Interface:
|
class Interface:
|
||||||
def __init__(self, name, config):
|
def __init__(self, name, config):
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -529,7 +507,7 @@ class TestContext(Namespace):
|
|||||||
os.environ['IWD_SIM_KEYS'] = sim_keys
|
os.environ['IWD_SIM_KEYS'] = sim_keys
|
||||||
return
|
return
|
||||||
|
|
||||||
if not find_binary(['ofonod']) or not find_binary(['phonesim']):
|
if not shutil.which('ofonod') or not shutil.which(['phonesim']):
|
||||||
print("Ofono or Phonesim not found, skipping test")
|
print("Ofono or Phonesim not found, skipping test")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user