You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to ensure its tests are meaningful even if color is disabled, the TestColorized test object in test_argparse modifies _colorize.can_colorize during setup, but does not subsequently restore it to the original value. As a consequence, the rest of the test session is polluted with colors/color codes even if NO_COLOR=1, or when in a dumb terminal or pipe. By comparison, we can look at the output of a similar setup in test_regrtest that uses mock.patch to only affect the state in that one test.
Given:
export NO_COLOR=1
Expected:
./python -m test test_regrtest -m TestColorized
Polluted visuals:
./python -m test test_argparse test_regrtest -m TestColorized
Polluted text:
./python -m test test_argparse test_regrtest -m TestColorized > OUTPUT.txt
less OUTPUT.txt
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
In order to ensure its tests are meaningful even if color is disabled, the
TestColorized
test object intest_argparse
modifies_colorize.can_colorize
during setup, but does not subsequently restore it to the original value. As a consequence, the rest of the test session is polluted with colors/color codes even ifNO_COLOR=1
, or when in a dumb terminal or pipe. By comparison, we can look at the output of a similar setup intest_regrtest
that usesmock.patch
to only affect the state in that one test.Given:
Expected:
Polluted visuals:
Polluted text:
CPython versions tested on:
CPython main branch, 3.14
Operating systems tested on:
Linux
Linked PRs
setUp/tearDown
of_colorize.can_colorize
intest_argparse
#135238The text was updated successfully, but these errors were encountered: