gh-128595: Default to stdout isatty for colour detection instead of stderr (#128498)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Hugo van Kemenade 2025-01-20 12:52:42 +02:00 committed by GitHub
parent a429159797
commit 6f167d7134
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 38 additions and 23 deletions

View file

@ -45,7 +45,7 @@ class TextTestResult(result.TestResult):
self.showAll = verbosity > 1
self.dots = verbosity == 1
self.descriptions = descriptions
self._ansi = get_colors()
self._ansi = get_colors(file=stream)
self._newline = True
self.durations = durations
@ -286,7 +286,7 @@ class TextTestRunner(object):
expected_fails, unexpected_successes, skipped = results
infos = []
ansi = get_colors()
ansi = get_colors(file=self.stream)
bold_red = ansi.BOLD_RED
green = ansi.GREEN
red = ansi.RED