From acdcc38b621f29eadfca1be1f2ab4c2a51b6b066 Mon Sep 17 00:00:00 2001 From: Dave Bacon Date: Fri, 8 Apr 2022 13:26:19 -0700 Subject: [PATCH] Make check scripts run pytest in parallel (#5143) The tests were made parallel in CI, but this updates the scripts to run in parallel. Respects if user overrides with different level of parallelism. --- check/pytest | 8 ++++++++ check/pytest-and-incremental-coverage | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/check/pytest b/check/pytest index e63bf6c07cf..27c9861a4cb 100755 --- a/check/pytest +++ b/check/pytest @@ -19,14 +19,22 @@ cd "$(git rev-parse --show-toplevel)" PYTEST_ARGS=() ACTUALLY_QUIET="" +PARALLEL="" for arg in "$@"; do if [[ "${arg}" == "--actually-quiet" ]]; then ACTUALLY_QUIET=1 else + if [[ "${arg}" == "-n" ]]; then + PARALLEL=1 + fi PYTEST_ARGS+=("${arg}") fi done +if [ -z "${PARALLEL}" ]; then + PYTEST_ARGS+=("-n=auto") +fi + source dev_tools/pypath PYTHON_VERSION=$(python -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/') if [ "$PYTHON_VERSION" -lt "37" ]; then diff --git a/check/pytest-and-incremental-coverage b/check/pytest-and-incremental-coverage index 027c2260fa1..0d681fe963a 100755 --- a/check/pytest-and-incremental-coverage +++ b/check/pytest-and-incremental-coverage @@ -79,7 +79,7 @@ check/pytest --actually-quiet \ pytest_result=$? -# assume succesful cover_result in case coverage is not run +# assume successful cover_result in case coverage is not run cover_result=0 if (( $ANALYZE_COV )); then # Convert to .py,cover files.