-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
Always pass FORCE_COLOR & NO_COLOR to the environment #3172
Conversation
4d67f1b
to
e9c339b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://no-color.org/ and FORCE_COLOR are the standard env vars. These app-specific ones don't get to be in the core.
I went with def should_do_markup(file: TextIO) -> bool:
if os.environ.get("PY_COLORS") == "1":
return True
if os.environ.get("PY_COLORS") == "0":
return False
if "NO_COLOR" in os.environ:
return False
if "FORCE_COLOR" in os.environ:
return True
return (
hasattr(file, "isatty") and file.isatty() and os.environ.get("TERM") != "dumb"
) May I repurpose this pull request to add |
I don't think you need to add support for them. They should work today. Did you find the opposite? |
[testenv]
commands = python3 -c 'import os; print(os.environ.get("FORCE_COLOR"))'
(same for |
If that doesn't work, a pull request is welcome. Just make sure to add the test and the changelog. |
May you please reopen the pull request or should I send a new one? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add test and changelog.
d216ab4
to
c4e868b
Compare
@gaborbernat I have repurposed the pull request to pass pass |
Yeah, but the CI is failing now that's blocking progress. |
c52b728
to
2de4f00
Compare
The environment variables `FORCE_COLOR` and `NO_COLOR`are a popular way to force or disable color output. An example usage is pytest being run under a CI system.
2de4f00
to
e17dda1
Compare
A test was failing under Windows OS. I also fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [tox](https://togithub.com/tox-dev/tox) ([changelog](https://tox.wiki/en/latest/changelog.html)) | `~4.11.0` -> `~4.12.0` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/tox/4.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/tox/4.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/tox/4.11.4/4.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/tox/4.11.4/4.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>tox-dev/tox (tox)</summary> ### [`v4.12.0`](https://togithub.com/tox-dev/tox/releases/tag/4.12.0) [Compare Source](https://togithub.com/tox-dev/tox/compare/4.11.4...4.12.0) <!-- Release notes generated using configuration in .github/release.yml at 4.12.0 --> #### What's Changed - Exclude bots from generated release notes by [@​hugovk](https://togithub.com/hugovk) in [https://github.com/tox-dev/tox/pull/3163](https://togithub.com/tox-dev/tox/pull/3163) - Imply `--parallel` when `--parallel-no-spinner` is passed by [@​tusharsadhwani](https://togithub.com/tusharsadhwani) in [https://github.com/tox-dev/tox/pull/3159](https://togithub.com/tox-dev/tox/pull/3159) - Fix 'open an issue' link in development.rst by [@​TheRealFalcon](https://togithub.com/TheRealFalcon) in [https://github.com/tox-dev/tox/pull/3179](https://togithub.com/tox-dev/tox/pull/3179) - Fix the CI by [@​gaborbernat](https://togithub.com/gaborbernat) in [https://github.com/tox-dev/tox/pull/3183](https://togithub.com/tox-dev/tox/pull/3183) - Always pass FORCE_COLOR & NO_COLOR to the environment by [@​hashar](https://togithub.com/hashar) in [https://github.com/tox-dev/tox/pull/3172](https://togithub.com/tox-dev/tox/pull/3172) #### New Contributors - [@​tusharsadhwani](https://togithub.com/tusharsadhwani) made their first contribution in [https://github.com/tox-dev/tox/pull/3159](https://togithub.com/tox-dev/tox/pull/3159) - [@​TheRealFalcon](https://togithub.com/TheRealFalcon) made their first contribution in [https://github.com/tox-dev/tox/pull/3179](https://togithub.com/tox-dev/tox/pull/3179) **Full Changelog**: tox-dev/tox@4.11.4...4.12.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/naa0yama/pythonboilerplate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The environment variables
FORCE_COLOR
andNO_COLOR
are a popular way to force or disable color output. An example usage is pytest being run under a CI system.tox -e fix
)docs/changelog
folder