Skip to content

Commit

Permalink
Always pass PY_COLORS to the environment
Browse files Browse the repository at this point in the history
The environment variable is a popular way to force color output, an
example being pytest being run under a CI system.
  • Loading branch information
hashar committed Dec 14, 2023
1 parent 383845a commit e9c339b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changelog/3171.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Always ``PY_COLORS`` to the environment
1 change: 1 addition & 0 deletions src/tox/tox_env/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def _default_pass_env(self) -> list[str]:
"LD_LIBRARY_PATH", # location of libs
"LDFLAGS", # linker flags
"HOME", # needed for `os.path.expanduser()` on non-Windows systems
"PY_COLORS", # Popular way to force color output in CI
]
if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM
env.append("TERM")
Expand Down
1 change: 1 addition & 0 deletions tests/session/cmd/test_show_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
+ (["PROGRAMDATA"] if is_win else [])
+ (["PROGRAMFILES"] if is_win else [])
+ (["PROGRAMFILES(x86)"] if is_win else [])
+ (["PY_COLORS"])
+ ["REQUESTS_CA_BUNDLE", "SSL_CERT_FILE"]
+ (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else [])
+ (["TERM"] if stdout_is_atty else [])
Expand Down

0 comments on commit e9c339b

Please sign in to comment.