From 2a44ad113d796dd166badea6ec151306a7a6bec7 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 1 Mar 2021 21:01:51 +0100 Subject: [PATCH] configure: Pick up the correct pytest executable We were looking for `python` in the `pytest --version` output --- configure | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/configure b/configure index b6b1e2cd3..6282eca29 100755 --- a/configure +++ b/configure @@ -56,10 +56,17 @@ default_cwarnflags() default_pytest() { - PYTEST_BINS="pytest py.test pytest3 pytest-3" + # Since we just checked that we have python3 we give that one the + # most priority and then fall back to some common aliases. + PYTEST_BINS="python3 -m pytest,pytest,py.test,pytest3,pytest-3" + IFS=',' for p in $PYTEST_BINS; do - if [ "$(which $p)" != "" ] ; then - "$p" --version 2>&1 | grep -q "python3" || continue + # If it is a combined command such as `python3 -m pytest` we + # want to only call which on the executable + exe=$(echo "$p" | awk '{print $1}') + # shellcheck disable=SC2086 + if [ "$(which $exe)" != "" ] ; then + "$p" --version 2>&1 | grep -q "pytest" || continue echo "$p" return fi