[PATCH 1/3] configure: check for pytest binary

David Bremner david at tethera.net
Sun Mar 25 10:40:32 PDT 2018


This is to support future use of pytest in the test suite
---
 configure | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/configure b/configure
index b177b141..ab45878d 100755
--- a/configure
+++ b/configure
@@ -62,6 +62,7 @@ CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
 LDFLAGS=${LDFLAGS:-}
 XAPIAN_CONFIG=${XAPIAN_CONFIG:-}
 PYTHON=${PYTHON:-}
+PYTEST=${PYTEST:-}
 
 # We don't allow the EMACS or GZIP Makefile variables inherit values
 # from the environment as we do with CC and CXX above. The reason is
@@ -118,6 +119,8 @@ Other environment variables can be used to control configure itself,
 			library. [$XAPIAN_CONFIG]
 	PYTHON		Name of python command to use in
 			configure and the test suite.
+        PYTEST		Name of pytest command to use in
+                        the test suite.
 
 Additionally, various options can be specified on the configure
 command line.
@@ -571,6 +574,24 @@ if [ $have_python -eq 0 ]; then
     errors=$((errors + 1))
 fi
 
+pytest=""
+if [ $have_python -eq 1 ]; then
+    printf "Checking for pytest... "
+    have_pytest=0
+
+    for name in ${PYTEST} pytest-3 pytest pytest-2; do
+        if command -v $name > /dev/null; then
+            have_pytest=1
+            pytest=$name
+            printf "Yes (%s).\n" $pytest
+            break
+        fi
+    done
+    if [ $have_pytest -eq 0 ]; then
+        printf "No (some tests may be skipped).\n"
+    fi
+fi
+
 printf "Checking for valgrind development files... "
 if pkg-config --exists valgrind; then
     printf "Yes.\n"
@@ -1234,6 +1255,9 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))
 # Name of python interpreter
 NOTMUCH_PYTHON=${python}
 
+# Name of pytest runner
+NOTMUCH_PYTEST=${pytest}
+
 # Are the ruby development files (and ruby) available? If not skip
 # building/testing ruby bindings.
 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
-- 
2.16.2



More information about the notmuch mailing list