Skip to content

Commit e9c339b

Browse files
committed
Always pass PY_COLORS to the environment
The environment variable is a popular way to force color output, an example being pytest being run under a CI system.
1 parent 383845a commit e9c339b

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

docs/changelog/3171.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Always ``PY_COLORS`` to the environment

src/tox/tox_env/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def _default_pass_env(self) -> list[str]:
219219
"LD_LIBRARY_PATH", # location of libs
220220
"LDFLAGS", # linker flags
221221
"HOME", # needed for `os.path.expanduser()` on non-Windows systems
222+
"PY_COLORS", # Popular way to force color output in CI
222223
]
223224
if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM
224225
env.append("TERM")

tests/session/cmd/test_show_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
130130
+ (["PROGRAMDATA"] if is_win else [])
131131
+ (["PROGRAMFILES"] if is_win else [])
132132
+ (["PROGRAMFILES(x86)"] if is_win else [])
133+
+ (["PY_COLORS"])
133134
+ ["REQUESTS_CA_BUNDLE", "SSL_CERT_FILE"]
134135
+ (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else [])
135136
+ (["TERM"] if stdout_is_atty else [])

0 commit comments

Comments
 (0)