aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-03-20 00:54:56 -0400
committerNirbheek Chauhan <nirbheek@centricular.com>2022-04-19 22:43:25 +0530
commit9687a0a12261888120add92af01b390bb3bce251 (patch)
tree317a4743fecee0b7067494d7694b78e9f0eb0b29 /run_project_tests.py
parent0c8a41796f364c68abe2dfa19c42201f8a7b432f (diff)
downloadmeson-9687a0a12261888120add92af01b390bb3bce251.zip
meson-9687a0a12261888120add92af01b390bb3bce251.tar.gz
meson-9687a0a12261888120add92af01b390bb3bce251.tar.bz2
project tests: do not use tqdm progress bars for a single test
This can happen for example with `--only fpga` as that category has exactly one test.
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index ea8f901..5bab53e 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -1229,19 +1229,21 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
# Ensure we only cancel once
tests_canceled = False
- # Optionally enable the tqdm progress bar
+ # Optionally enable the tqdm progress bar, but only if there is at least
+ # one LogRunFuture and one TestRunFuture
global safe_print
futures_iter: T.Iterable[RunFutureUnion] = futures
- try:
- from tqdm import tqdm
- futures_iter = tqdm(futures, desc='Running tests', unit='test')
+ if len(futures) > 2:
+ try:
+ from tqdm import tqdm
+ futures_iter = tqdm(futures, desc='Running tests', unit='test')
- def tqdm_print(*args: mlog.TV_Loggable, sep: str = ' ') -> None:
- tqdm.write(sep.join([str(x) for x in args]))
+ def tqdm_print(*args: mlog.TV_Loggable, sep: str = ' ') -> None:
+ tqdm.write(sep.join([str(x) for x in args]))
- safe_print = tqdm_print
- except ImportError:
- pass
+ safe_print = tqdm_print
+ except ImportError:
+ pass
# Wait and handle the test results and print the stored log output
for f in futures_iter: