autotest: add a lineno method

allows for debug like this:

print(f"{self.lineno()} {self.mav.message_hooks=}")
This commit is contained in:
Peter Barker 2024-06-03 18:28:03 +10:00 committed by Peter Barker
parent 2a964c44d4
commit 7cf96fb0a1
1 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import random
import tempfile
import threading
import enum
from inspect import currentframe, getframeinfo
from pathlib import Path
from MAVProxy.modules.lib import mp_util
@ -6417,6 +6418,12 @@ class TestSuite(ABC):
#################################################
# UTILITIES
#################################################
def lineno(self):
'''return line number'''
frameinfo = getframeinfo(currentframe().f_back)
# print(frameinfo.filename, frameinfo.lineno)
return frameinfo.lineno
@staticmethod
def longitude_scale(lat):
ret = math.cos(lat * (math.radians(1)))