autotest: install multiple test scripts with one call

This commit is contained in:
Peter Barker 2024-06-24 09:28:36 +10:00 committed by Peter Barker
parent 9fdf52c59c
commit b841f5517e
2 changed files with 17 additions and 10 deletions

View File

@ -5311,13 +5311,13 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
})
self.install_test_modules_context()
self.install_mavlink_module_context()
for script in [
"scripting_test.lua",
"math.lua",
"strings.lua",
"mavlink_test.lua",
]:
self.install_test_script_context(script)
self.install_test_scripts_context([
"scripting_test.lua",
"math.lua",
"strings.lua",
"mavlink_test.lua",
])
self.context_collect('STATUSTEXT')
self.context_collect('NAMED_VALUE_FLOAT')

View File

@ -4632,11 +4632,18 @@ class TestSuite(ABC):
self.install_example_script(scriptname)
self.context_get().installed_scripts.append(scriptname)
def install_test_script_context(self, scriptname):
def install_test_script_context(self, scriptnames):
'''installs an test script which will be removed when the context goes
away'''
self.install_test_script(scriptname)
self.context_get().installed_scripts.append(scriptname)
if isinstance(scriptnames, str):
scriptnames = [scriptnames]
for scriptname in scriptnames:
self.install_test_script(scriptname)
self.context_get().installed_scripts.extend(scriptnames)
def install_test_scripts_context(self, *args, **kwargs):
'''same as install_test_scripts_context - just pluralised name'''
return self.install_test_script_context(*args, **kwargs)
def install_test_modules_context(self):
'''installs test modules which will be removed when the context goes