diff --git a/check/doctest b/check/doctest index a26b6cff433..5f3497b9d9a 100755 --- a/check/doctest +++ b/check/doctest @@ -18,6 +18,6 @@ thisdir="$(dirname "${BASH_SOURCE[0]}")" || exit $? topdir="$(git -C "${thisdir}" rev-parse --show-toplevel)" || exit $? cd "${topdir}" || exit $? -source dev_tools/pypath +source dev_tools/pypath || exit $? python dev_tools/docs/run_doctest.py "$@" diff --git a/check/pytest b/check/pytest index 72c439b4ec3..fd8ddf739a2 100755 --- a/check/pytest +++ b/check/pytest @@ -20,7 +20,7 @@ cd "${topdir}" || exit $? # (the last `-n` option wins) PYTEST_ARGS=( "-n=auto" "$@" ) -source dev_tools/pypath +source dev_tools/pypath || exit $? pytest "${PYTEST_ARGS[@]}" RESULT=$? diff --git a/check/pytest-and-incremental-coverage b/check/pytest-and-incremental-coverage index 14fe907c99a..05693bb476a 100755 --- a/check/pytest-and-incremental-coverage +++ b/check/pytest-and-incremental-coverage @@ -68,7 +68,7 @@ else rev="${base}" fi -source dev_tools/pypath +source dev_tools/pypath || exit $? # Run tests while producing coverage files. check/pytest --cov \ diff --git a/check/pytest-changed-files b/check/pytest-changed-files index ec3c3d72949..974b9472347 100755 --- a/check/pytest-changed-files +++ b/check/pytest-changed-files @@ -76,6 +76,6 @@ if [ "${num_changed}" -eq 0 ]; then exit 0 fi -source dev_tools/pypath +source dev_tools/pypath || exit $? pytest "${rest[@]}" "${changed[@]}" diff --git a/check/pytest-changed-files-and-incremental-coverage b/check/pytest-changed-files-and-incremental-coverage index 246aa0e97f3..373e4075e51 100755 --- a/check/pytest-changed-files-and-incremental-coverage +++ b/check/pytest-changed-files-and-incremental-coverage @@ -87,7 +87,7 @@ if [ "${#changed_python_tests[@]}" -eq 0 ]; then exit 0 fi -source dev_tools/pypath +source dev_tools/pypath || exit $? # Run tests while producing coverage files. check/pytest "${changed_python_tests[@]}" \ diff --git a/dev_tools/pypath b/dev_tools/pypath index 807b1d32aab..37461620b4c 100755 --- a/dev_tools/pypath +++ b/dev_tools/pypath @@ -29,6 +29,12 @@ else _PYPATH_BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" fi +if ! python --version | grep -q -F "Python 3."; then + echo "python command does not start Python 3" >&2 + echo "Please use a virtual environment created for Python 3." >&2 + return 2 +fi + _PYPATH_PREFIX="${_PYPATH_BASE_DIR}$( cd "${_PYPATH_BASE_DIR}" && env PYTHONPATH=. python dev_tools/modules.py list --mode folder |