如何强制 pytest 编写颜色输出? [英] How do I force pytest to write color output?

查看:37
本文介绍了如何强制 pytest 编写颜色输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何强制 pytest 以颜色显示结果,即使在写入管道时也是如此?似乎没有任何命令行选项可以这样做.

How do I force pytest to show the results in color, even when writing to a pipe? There does not seem to be any command line option to do so.

推荐答案

As of 2.5.0 py.test has the option --color=yes

As of 2.5.0 py.test has the option --color=yes

从 2.7.0 开始,应该也可以这样做:

As of 2.7.0, it should be also possible to do:

export PYTEST_ADDOPTS="--color=yes"

这篇关于如何强制 pytest 编写颜色输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆