Closed
Description
When running pytest on GitHub Actions (like we do ourselves, random example), the output is not colored.
pytest does color output on Travis CI by default, so it could be argued that this is somehow GitHub Action's fault. However, other tools (e.g. eslint
, and I think mypy
) seem to colorize their output on GitHub actions just fine, without needing to force them! From what I've seen, those tools seem to be influenced by the TERM
environment variable, while pytest's (or pylib's?) autodetection seems to work differently?
As a workaround, this helps (as part of the step definition):
- name: "Run pytest"
env:
PYTEST_ADDOPTS: "--color=yes"
run: pytest
(If you run pytest via tox, make sure to add PYTEST_ADDOPTS
to passenv
!)