diff --git a/common/build-style/python3-module.sh b/common/build-style/python3-module.sh index ad5fdff252..093bdae8a0 100644 --- a/common/build-style/python3-module.sh +++ b/common/build-style/python3-module.sh @@ -24,8 +24,9 @@ do_build() { } do_check() { - if python3 -m pytest --help >/dev/null 2>&1; then - python3 -m pytest ${make_check_args} ${make_check_target} + if python3 -c 'import pytest' >/dev/null 2>&1; then + PYTHONPATH="$(cd build/lib* && pwd)" \ + python3 -m pytest ${make_check_args} ${make_check_target} else # Fall back to deprecated setup.py test orchestration without pytest if [ -z "$make_check_target" ]; then diff --git a/common/build-style/python3-pep517.sh b/common/build-style/python3-pep517.sh index 4051185a28..075f954a1a 100644 --- a/common/build-style/python3-pep517.sh +++ b/common/build-style/python3-pep517.sh @@ -13,7 +13,7 @@ do_build() { } do_check() { - if python3 -m pytest --help >/dev/null 2>&1; then + if python3 -c 'import pytest' >/dev/null 2>&1; then python3 -m pytest ${make_check_args} ${make_check_target} else msg_warn "Unable to determine tests for PEP517 Python templates"