[toranj] update verify() to print line-no and test-name (#2662)

This commit is contained in:
Abtin Keshavarzian
2018-04-17 09:09:34 -07:00
committed by Jonathan Hui
parent 7512e23b59
commit 1bb139121c
+4 -1
View File
@@ -34,6 +34,7 @@ import weakref
import subprocess
import socket
import asyncore
import inspect
#----------------------------------------------------------------------------------------------------------------------
# wpantund properties
@@ -724,8 +725,10 @@ class AsyncReceiver(asyncore.dispatcher):
#-----------------------------------------------------------------------------------------------------------------------
def verify(condition):
"""Verifies that a `condition` is true, otherwise exits"""
if not condition:
print 'verify() failed'
calling_frame = inspect.currentframe().f_back
print 'verify() failed at line {} in "{}"'.format(calling_frame.f_lineno, calling_frame.f_code.co_filename)
exit(1)