test_util.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:NFStest 作者: thombashi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号