def _print_msg(self, msg, tid=None, single=0):
"""Display message to the screen and to the log file."""
if single and self._empty_msg:
# Display only a single empty line
return
tidmsg_l = '' if tid is None else _test_map[tid]
self.write_log(tidmsg_l + msg)
if self.isatty:
tidmsg_s = _test_map_c.get(tid, tidmsg_l)
if tid == HEAD:
msg = VT_HL + VT_BOLD + msg + VT_NORM
elif tid == INFO:
msg = VT_BLUE + VT_BOLD + msg + VT_NORM
elif tid in [PASS, FAIL]:
msg = VT_BOLD + msg + VT_NORM
else:
tidmsg_s = tidmsg_l
print tidmsg_s + msg
sys.stdout.flush()
if len(msg) > 0:
self._empty_msg = 0
self._disp_msgs += 1
else:
self._empty_msg = 1
评论列表
文章目录