diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-03-20 00:54:56 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-04-03 16:06:33 -0400 |
commit | ce7a67e511467f72c52c950fb0e0c48a69054974 (patch) | |
tree | 8e907742f0c7aea7dc8142a8bd97f81f7c2c2c6e | |
parent | 01a7aa0a4d7314e2e007f04baf9f06f6ae52a5ec (diff) | |
download | meson-ce7a67e511467f72c52c950fb0e0c48a69054974.zip meson-ce7a67e511467f72c52c950fb0e0c48a69054974.tar.gz meson-ce7a67e511467f72c52c950fb0e0c48a69054974.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.
-rwxr-xr-x | run_project_tests.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index e08d0cd..ed09870 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -1230,19 +1230,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: |