Skip to content

Commit

Permalink
Make check scripts run pytest in parallel (quantumlib#5143)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dabacon authored and tonybruguier committed Apr 19, 2022
1 parent df5546d commit acdcc38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions check/pytest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion check/pytest-and-incremental-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit acdcc38

Please sign in to comment.