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 4d67f1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
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 4d67f1b

Please sign in to comment.