Skip to content

Commit cea9e1d

Browse files
cmaloneyvstinner
andcommitted
Apply review fixes
Co-authored-by: Victor Stinner <[email protected]>
1 parent d3d5b12 commit cea9e1d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Lib/test/libregrtest/setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import unittest
99
from test import support
1010
from test.support.os_helper import TESTFN_UNDECODABLE, FS_NONASCII
11+
from _colorize import can_colorize # type: ignore[import-not-found]
1112

1213
from .filter import set_match_tests
1314
from .runtests import RunTests
@@ -139,3 +140,6 @@ def setup_tests(runtests: RunTests) -> None:
139140
gc.set_threshold(runtests.gc_threshold)
140141

141142
random.seed(runtests.random_seed)
143+
144+
if can_colorize(file=sys.stdout):
145+
os.environ['FORCE_COLOR'] = "1"

Lib/test/libregrtest/single.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import gc
33
import importlib
44
import io
5-
import os
65
import sys
76
import time
87
import traceback
98
import unittest
109

11-
from _colorize import can_colorize, get_colors # type: ignore[import-not-found]
10+
from _colorize import get_colors # type: ignore[import-not-found]
1211
from test import support
1312
from test.support import threading_helper
1413

@@ -275,9 +274,6 @@ def _runtest(result: TestResult, runtests: RunTests) -> None:
275274
output_on_failure = runtests.output_on_failure
276275
timeout = runtests.timeout
277276

278-
if can_colorize(file=sys.stdout):
279-
os.environ['FORCE_COLOR'] = "1"
280-
281277
if timeout is not None and threading_helper.can_start_thread:
282278
use_timeout = True
283279
faulthandler.dump_traceback_later(timeout, exit=True)

Lib/test/libregrtest/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def create_worker_process(runtests: WorkerRunTests, output_fd: int,
3333
env['TEMP'] = tmp_dir
3434
env['TMP'] = tmp_dir
3535

36-
# The subcommand is run with a temporary output which means it is not a tty
36+
# The subcommand is run with a temporary output which means it is not a TTY
3737
# and won't auto-color. The test results are printed to stdout so if we can
3838
# color that have the subprocess use color.
3939
if can_colorize(file=sys.stdout):

0 commit comments

Comments
 (0)