Skip to content

Commit

Permalink
run_project_tests: Don't try to use tqdm when stdout is not a tty
Browse files Browse the repository at this point in the history
Like when piped to something like less, where tqdm just makes a mess of
the output instead of providing something helpful.
  • Loading branch information
dcbaker authored and nirbheek committed Aug 8, 2022
1 parent 235c786 commit 8e9dc6e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion run_project_tests.py
Expand Up @@ -1245,7 +1245,7 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
# one LogRunFuture and one TestRunFuture
global safe_print
futures_iter: T.Iterable[RunFutureUnion] = futures
if len(futures) > 2:
if len(futures) > 2 and sys.stdout.isatty():
try:
from tqdm import tqdm
futures_iter = tqdm(futures, desc='Running tests', unit='test')
Expand Down

0 comments on commit 8e9dc6e

Please sign in to comment.