Skip to content

Commit 7cf96fb

Browse files
committed
autotest: add a lineno method
allows for debug like this: print(f"{self.lineno()} {self.mav.message_hooks=}")
1 parent 2a964c4 commit 7cf96fb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Tools/autotest/vehicle_test_suite.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import tempfile
3535
import threading
3636
import enum
37+
from inspect import currentframe, getframeinfo
3738
from pathlib import Path
3839

3940
from MAVProxy.modules.lib import mp_util
@@ -6417,6 +6418,12 @@ def verify_parameter_values(self, parameter_stuff, max_delta=0.0):
64176418
#################################################
64186419
# UTILITIES
64196420
#################################################
6421+
def lineno(self):
6422+
'''return line number'''
6423+
frameinfo = getframeinfo(currentframe().f_back)
6424+
# print(frameinfo.filename, frameinfo.lineno)
6425+
return frameinfo.lineno
6426+
64206427
@staticmethod
64216428
def longitude_scale(lat):
64226429
ret = math.cos(lat * (math.radians(1)))

0 commit comments

Comments
 (0)