-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No colors by default on GitHub Actions #7443
Comments
Yep, this happens with pre-commit too, and many, many other tools. The problem is GitHub Actions does not provide a tty: actions/runner#241. This issue mentions pytest, and GitHub say it's low in their backlog and they have no plans to fix it (actions/runner#241 (comment)). If you run pytest via tox, a similar workaround is to put it in config (eg. |
Please see PR #7462. |
IMHO, envvars to force colouring are VERY inconsistent. This is true even in the Python ecosystem. For example, see this issue, tartley/colorama#230 (/cc @jhol @tartley @wiggin15 @eric-wieser), tox-dev/tox#1468 (/cc @gaborbernat)... I believe it would be desirable if the community could talk and agree on a couple of envvars. I like @jhol's |
@eine True, but this seems unrelated to this issue? |
@The-Compiler, I believe it is! Should pytest work with EDIT FTR:
|
The general behavior is:
|
I think based on the discussions on #7462, we can close this as "wontfix" because pytest can't reliably detect this in GitHub actions. What do you think @The-Compiler ? |
Agree. As @The-Compiler commented in #7462 (comment), I think that the following is the way to go: env:
PY_COLORS: "1" For example: https://github.com/VUnit/vunit/blob/master/.github/workflows/push.yml#L12 When/if tox supports it: env:
FORCE_COLOR: "1" |
Sounds reasonable! |
GitHub Actions does not show colour outputs for pytest by default (pytest-dev/pytest#7443), but it can be enabled using `--color=yes` flag.
…lor (#3330) GitHub Actions does not show colour outputs for pytest by default (pytest-dev/pytest#7443), but it can be enabled using `--color=yes` flag.
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 thinkmypy
) 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 theTERM
environment variable, while pytest's (or pylib's?) autodetection seems to work differently?As a workaround, this helps (as part of the step definition):
(If you run pytest via tox, make sure to add
PYTEST_ADDOPTS
topassenv
!)The text was updated successfully, but these errors were encountered: