7 """ Bundles static methods for test case logging. """ 11 return not cls.
_param_compact()
and rospy.get_param(
'~print_debug_positive',
True)
15 return cls.
_param_compact()
or rospy.get_param(
'~print_debug_negative',
True)
19 return rospy.get_param(
'~compact_format',
False)
33 """ Conditionally mute the rospy logging channels. """ 35 rospy.loginfo = rospy.logdebug
37 rospy.logwarn = rospy.logdebug
38 if not cls.
_param_compact()
and rospy.get_param(
'~mute_error',
False):
39 rospy.logerr = rospy.logdebug
43 """ Print a positive intermediate result. """ 45 print(
'\033[0m\033[1m +\033[0m %s' % str(text))
49 """ Print a negative intermediate result. """ 51 print(
'\033[0m\033[1m -\033[0m %s' % str(text))
55 """ Print the title of the test, should be called once and before any other print method. """ 56 test_result =
' > %s' % result
if result
is not None else '' 57 print(
'\033[34;1m#%2d %s \033[0m\033[34m(%s%s)\033[0m' % (
58 cls.
_counter(), test_name, test_class, test_result
63 """ Print the result, should be called once and after any other print method. """ 64 test_result =
'completed' if success
else 'failed' 65 color =
'32' if success
else '31' 66 print(
'\033[%s;1m%s\033[0m\033[%sm %s %s!\033[0m' % (color, cls.
_prefix(), color, test_name, test_result))
70 """ Instead of a result, print the failure of a test case once after any other print method. """ 72 print(
'\033[31;1m%s\033[0m\033[31m %s\033[0m' % (cls.
_prefix(), str(text)))
76 """ Print an internal error that might cause unexpected behavior, but does not cause failure itself. """ 77 print(
'\033[33;1m \033[0m\033[33m %s\033[0m' % str(text))
80 """ DO NOT USE: use class print methods instead. """ 81 raise NotImplementedError(
"use static methods and attributes")
def print_result(cls, test_name, success)
def print_positive(cls, text)
def print_negative(cls, text)
def print_error(cls, text)
def print_failure(cls, text)
def print_title(cls, test_name, test_class, result=None)