Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force pytest to write color output?

Tags:

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.

like image 511
JanKanis Avatar asked Jun 12 '13 15:06

JanKanis


People also ask

How do I run pytest in verbose mode?

Running pytest -vv should make your output more verbose. If you want your output to be less verbose, try pytest -q or pytest --quiet .

How do I invoke pytest?

Calling pytest through python -m pytest You can invoke testing through the Python interpreter from the command line: python -m pytest [...] This is almost equivalent to invoking the command line script pytest [...] directly, except that calling via python will also add the current directory to sys.

What is verbosity in pytest?

Verbosity. The -v flag controls the verbosity of pytest output in various aspects: test session progress, assertion details when tests fail, fixtures details with --fixtures , etc.

Which command can be used to show all available fixtures?

Additionally, if you wish to display a list of fixtures for each test, try the --fixtures-per-test flag.


1 Answers

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" 
like image 82
Johan Lübcke Avatar answered Sep 29 '22 10:09

Johan Lübcke