Skip to content

Commit fc80080

Browse files
hashargaborbernat
andauthored
Always pass FORCE_COLOR & NO_COLOR to the environment (#3172)
Co-authored-by: Bernát Gábor <[email protected]>
1 parent 659f714 commit fc80080

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
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 pass ``FORCE_COLOR`` and ``NO_COLOR`` to the environment

src/tox/tox_env/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ def _default_pass_env(self) -> list[str]: # noqa: PLR6301
220220
"LD_LIBRARY_PATH", # location of libs
221221
"LDFLAGS", # linker flags
222222
"HOME", # needed for `os.path.expanduser()` on non-Windows systems
223+
"FORCE_COLOR", # force color output
224+
"NO_COLOR", # disable color output
223225
]
224226
if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM
225227
env.append("TERM")

tests/session/cmd/test_show_config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
123123
+ (["APPDATA"] if is_win else [])
124124
+ ["CC", "CCSHARED", "CFLAGS"]
125125
+ (["COMSPEC"] if is_win else [])
126-
+ ["CPPFLAGS", "CURL_CA_BUNDLE", "CXX", "HOME", "LANG", "LANGUAGE", "LDFLAGS", "LD_LIBRARY_PATH"]
127-
+ (["MSYSTEM", "NUMBER_OF_PROCESSORS", "PATHEXT"] if is_win else [])
126+
+ ["CPPFLAGS", "CURL_CA_BUNDLE", "CXX", "FORCE_COLOR", "HOME", "LANG"]
127+
+ ["LANGUAGE", "LDFLAGS", "LD_LIBRARY_PATH"]
128+
+ (["MSYSTEM"] if is_win else [])
129+
+ ["NO_COLOR"]
130+
+ (["NUMBER_OF_PROCESSORS", "PATHEXT"] if is_win else [])
128131
+ ["PIP_*", "PKG_CONFIG", "PKG_CONFIG_PATH", "PKG_CONFIG_SYSROOT_DIR"]
129132
+ (["PROCESSOR_ARCHITECTURE"] if is_win else [])
130133
+ (["PROGRAMDATA"] if is_win else [])

0 commit comments

Comments
 (0)