Skip to content

Commit b52fb14

Browse files
lucash-devrustyrussell
authored andcommitted
pytest: Fix configure to find pytest when installed using pip3.
Installing pytest through pip3 (at least sometimes) doesn't create a script. This means calling `which` won't work. Changed configure so that it can also test if the module is present by calling python/python3. Change the error message for when pytest can't be found, so that it's clear to the user `configure` must be ran again after installing pytest.
1 parent cefb692 commit b52fb14

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ check:
216216

217217
pytest: $(ALL_PROGRAMS)
218218
ifndef PYTEST
219-
@echo "py.test is required to run the integration tests, please install using 'pip3 install -r tests/requirements.txt'"
219+
@echo "py.test is required to run the integration tests, please install using 'pip3 install -r tests/requirements.txt', and rerun 'configure'."
220220
exit 1
221221
else
222222
# Explicitly hand DEVELOPER and VALGRIND so you can override on make cmd line.

configure

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ find_pytest()
7171
return
7272
fi
7373
done
74+
75+
PYTHON_BINS="python python3"
76+
for p in $PYTHON_BINS; do
77+
if [ "$(which $p)" != "" ] ; then
78+
$p --version 2>&1 | grep -q "Python 3." || continue
79+
if $p -c "import pytest" ; then
80+
echo "$p -m pytest"
81+
return
82+
fi
83+
fi
84+
done
7485
}
7586

7687
PYTEST=${PYTEST:-`find_pytest`}

0 commit comments

Comments
 (0)