How do I force pytest to write color output?

JanKanis picture JanKanis · Jun 12, 2013 · Viewed 8k times · Source

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.

Answer

Johan Lübcke picture Johan Lübcke · Jun 27, 2014

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

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

export PYTEST_ADDOPTS="--color=yes"