diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index 04f0b57512..ff8b0c5eac 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -418,11 +418,11 @@ def run_specific_test(step, *args, **kwargs): print("Got %s" % str(tester)) for a in tester.tests(): - if not hasattr(a, 'name'): - a = Test(a[0], a[1], a[2]) + if type(a) != 'Test': + a = Test(a) print("Got %s" % (a.name)) if a.name == test: - return tester.run_tests([a]) + return (tester.autotest(tests=[a], allow_skips=False), tester) print("Failed to find test %s on %s" % (test, testname)) sys.exit(1) @@ -832,11 +832,9 @@ def list_subtests_for_vehicle(vehicle_type): subtests = tester.tests() sorted_list = [] for subtest in subtests: - if type(subtest) is tuple: - (name, description, function) = subtest - sorted_list.append([name, description]) - else: - sorted_list.append([subtest.name, subtest.description]) + if type(subtest) != 'Test': + subtest = Test(subtest) + sorted_list.append([subtest.name, subtest.description]) sorted_list.sort() for subtest in sorted_list: print("%s " % subtest[0], end='') diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 392d595ba6..e1597f33a4 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -12403,17 +12403,19 @@ switch value''' print("Had to force-reset SITL %u times" % (self.forced_post_test_sitl_reboots,)) - def autotest(self): + def autotest(self, tests=None, allow_skips=True): """Autotest used by ArduPilot autotest CI.""" + if tests is None: + tests = self.tests() all_tests = [] - for test in self.tests(): - if type(test) == Test: - all_tests.append(test) - continue - actual_test = Test(test) - all_tests.append(actual_test) + for test in tests: + if type(test) != Test: + test = Test(test) + all_tests.append(test) disabled = self.disabled_tests() + if not allow_skips: + disabled = {} tests = [] for test in all_tests: if test.name in disabled: