Skip to content

Commit

Permalink
autotest: add a lineno method
Browse files Browse the repository at this point in the history
allows for debug like this:

print(f"{self.lineno()} {self.mav.message_hooks=}")
  • Loading branch information
peterbarker committed Jun 9, 2024
1 parent 2a964c4 commit 7cf96fb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import tempfile
import threading
import enum
from inspect import currentframe, getframeinfo
from pathlib import Path

from MAVProxy.modules.lib import mp_util
Expand Down Expand Up @@ -6417,6 +6418,12 @@ def verify_parameter_values(self, parameter_stuff, max_delta=0.0):
#################################################
# 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)))
Expand Down

0 comments on commit 7cf96fb

Please sign in to comment.