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.
pull/10152/head
Eli Schwartz 3 years ago
parent 01a7aa0a4d
commit ce7a67e511
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 20
      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:

Loading…
Cancel
Save