From b841f5517ebaf84e17c9a1acafad0725ad4eea46 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 24 Jun 2024 09:28:36 +1000 Subject: [PATCH] autotest: install multiple test scripts with one call --- Tools/autotest/rover.py | 14 +++++++------- Tools/autotest/vehicle_test_suite.py | 13 ++++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Tools/autotest/rover.py b/Tools/autotest/rover.py index dba7c96157764..d53df91d73a51 100644 --- a/Tools/autotest/rover.py +++ b/Tools/autotest/rover.py @@ -5311,13 +5311,13 @@ def test_scripting_internal_test(self): }) 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') diff --git a/Tools/autotest/vehicle_test_suite.py b/Tools/autotest/vehicle_test_suite.py index 7fdef2bcc8450..4016c4f04749d 100644 --- a/Tools/autotest/vehicle_test_suite.py +++ b/Tools/autotest/vehicle_test_suite.py @@ -4632,11 +4632,18 @@ def install_example_script_context(self, scriptname): 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