Jenkins console output from jobs running py.test tests contains unexpected characters "[1m" "[0m" like
[1m============== test session starts ==============[0m
Apparently these characters are leftovers from py.test output formatting ("test session starts" shows up as bold and colored in a terminal window). Is there a way to disable the output formatting? py.test's "--color no" option is not enough.
In my case I'm running the pytest inside a docker by suing Jenkins descriptive pipeline, so need to verify several things:
First, add ansiColor to the options
pipeline {
...
options {
ansiColor('xterm')
...
}
...
}
Second, verify that you added the docker run command the flag -t
-t : Allocate a pseudo-tty
for docker-compose it's tty: true
Third, you can force colorize by adding --color=yes to the pytest command
python -m pytest --color=yes ...
--color=color color terminal output (yes/no/auto).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With