summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrun_project_tests.py12
-rwxr-xr-xrun_unittests.py3
2 files changed, 15 insertions, 0 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index 07431d4d3..af04f0ae4 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -273,6 +273,14 @@ backend: 'Backend'
backend_flags: T.List[str]
stop: bool = False
+is_worker_process: bool = False
+
+# Let's have colors in our CI output
+if under_ci:
+ def _ci_colorize_console() -> bool:
+ return not is_worker_process
+
+ mlog.colorize_console = _ci_colorize_console
class StopException(Exception):
def __init__(self) -> None:
@@ -574,6 +582,9 @@ def run_test(test: TestDef,
global compile_commands, clean_commands, test_commands, install_commands, uninstall_commands, backend, backend_flags, host_c_compiler
if state is not None:
compile_commands, clean_commands, test_commands, install_commands, uninstall_commands, backend, backend_flags, host_c_compiler = state
+ # Store that this is a worker process
+ global is_worker_process
+ is_worker_process = True
# Setup the test environment
assert not test.skip, 'Skipped thest should not be run'
build_dir = create_deterministic_builddir(test, use_tmp)
@@ -1210,6 +1221,7 @@ 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
global safe_print
futures_iter: T.Iterable[RunFutureUnion] = futures
try:
diff --git a/run_unittests.py b/run_unittests.py
index 6f5ec58b1..b2b7367b0 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -10237,6 +10237,9 @@ def main():
# time spawning a lot of processes to distribute tests to in that case.
if not running_single_tests(sys.argv, cases):
pytest_args += ['-n', 'auto']
+ # Let there be colors!
+ if 'CI' in os.environ:
+ pytest_args += ['--color=yes']
pytest_args += ['./run_unittests.py']
pytest_args += convert_args(sys.argv[1:])
return subprocess.run(python_command + ['-m', 'pytest'] + pytest_args).returncode