Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)
(cherry picked from commit
1b070060c025a00d43566a6df65aa7631861d7af)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
@contextlib.contextmanager
def clear_env():
with EnvironmentVarGuard() as mock_env:
- for var in "FORCE_COLOR", "NO_COLOR", "PYTHON_COLORS":
+ for var in "FORCE_COLOR", "NO_COLOR", "PYTHON_COLORS", "TERM":
mock_env.unset(var)
yield mock_env
--- /dev/null
+The tests of terminal colorization are no longer sensitive to the value of
+the ``TERM`` variable in the testing environment.
// Xcode log can't display color. Stdout will report that it is *not* a
// TTY.
setenv("NO_COLOR", "1", true);
- setenv("PY_COLORS", "0", true);
+ setenv("PYTHON_COLORS", "0", true);
// Arguments to pass into the test suite runner.
// argv[0] must identify the process; any subsequent arg