mirror of https://github.com/ArduPilot/ardupilot
Tools: fix lambda test
This commit is contained in:
parent
25282c2989
commit
7e12f16be6
|
@ -57,6 +57,7 @@ class AutoTestRover(AutoTest):
|
|||
return SITL_START_LOCATION
|
||||
|
||||
def init(self):
|
||||
super(AutoTestRover, self).init(os.path.realpath(__file__))
|
||||
if self.frame is None:
|
||||
self.frame = 'rover'
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ class AutoTestCopter(AutoTest):
|
|||
return 'ArduCopter'
|
||||
|
||||
def init(self):
|
||||
super(AutoTestCopter, self).init(os.path.realpath(__file__))
|
||||
if self.frame is None:
|
||||
self.frame = '+'
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class AutoTestPlane(AutoTest):
|
|||
return SITL_START_LOCATION
|
||||
|
||||
def init(self):
|
||||
super(AutoTestPlane, self).init(os.path.realpath(__file__))
|
||||
if self.frame is None:
|
||||
self.frame = 'plane-elevrev'
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class AutoTestSub(AutoTest):
|
|||
return SITL_START_LOCATION
|
||||
|
||||
def init(self):
|
||||
super(AutoTestSub, self).init(os.path.realpath(__file__))
|
||||
if self.frame is None:
|
||||
self.frame = 'vectored'
|
||||
|
||||
|
|
|
@ -1635,18 +1635,19 @@ class AutoTest(ABC):
|
|||
# check for lambda: test_function without paranthesis
|
||||
faulty_strings = re.findall(r"lambda\s*:\s*\w+.\w+\s*\)", f.read())
|
||||
if faulty_strings:
|
||||
desc = ("Syntax error in autotest lambda at : " +
|
||||
faulty_strings)
|
||||
desc = "Syntax error in autotest lambda at : \n"
|
||||
for x in range(len(faulty_strings)):
|
||||
desc += faulty_strings[x] + "\n"
|
||||
raise ErrorException(desc)
|
||||
except ErrorException:
|
||||
self.progress('FAILED: "%s"' % "Check for syntax mistake in autotest lambda")
|
||||
except ErrorException as msg:
|
||||
self.progress("FAILED: Check for syntax mistake in autotest lambda. \n" + str(msg))
|
||||
exit(1)
|
||||
self.progress('PASSED: "%s"' % "Check for syntax mistake in autotest lambda")
|
||||
self.progress("PASSED: Check for syntax mistake in autotest lambda")
|
||||
|
||||
@abc.abstractmethod
|
||||
def init(self):
|
||||
def init(self, file):
|
||||
"""Initilialize autotest feature."""
|
||||
pass
|
||||
self.check_test_syntax(test_file=os.path.realpath(file))
|
||||
|
||||
|
||||
def expect_command_ack(self, command):
|
||||
m = self.mav.recv_match(type='COMMAND_ACK', blocking=True, timeout=10)
|
||||
|
@ -2178,7 +2179,6 @@ switch value'''
|
|||
|
||||
def run_tests(self, tests):
|
||||
"""Autotest vehicle in SITL."""
|
||||
self.check_test_syntax(test_file=os.path.realpath(__file__))
|
||||
if self.run_tests_called:
|
||||
raise ValueError("run_tests called twice")
|
||||
self.run_tests_called = True
|
||||
|
|
|
@ -52,6 +52,7 @@ class AutoTestQuadPlane(AutoTest):
|
|||
self.sitl = None
|
||||
|
||||
def init(self):
|
||||
super(AutoTestQuadPlane, self).init(os.path.realpath(__file__))
|
||||
if self.frame is None:
|
||||
self.frame = 'quadplane'
|
||||
|
||||
|
|
Loading…
Reference in New Issue