From 8e9dc6e4c05854c657a25230d4507a49aa8cb6d4 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 30 Jun 2022 10:17:30 -0700 Subject: [PATCH] run_project_tests: Don't try to use tqdm when stdout is not a tty Like when piped to something like less, where tqdm just makes a mess of the output instead of providing something helpful. --- run_project_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_project_tests.py b/run_project_tests.py index 7cbce64d5e3f..fc5a969b7c6a 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -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')