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

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

Date:Mon, 26 Mar 2018 22:55:05 +0200

To:David Bremner ,Justus Winter ,David Bremner ,W. Trevor King

Cc:notmuch@notmuchmail.org

From:Floris Bruynooghe


On Sun, Mar 25 2018, David Bremner wrote:

> This is to support future use of pytest in the test suite

Thanks for having a go at this!

> ---
>  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

This is kind of not granular enough I think.  It would be better to
invoke pytest as "pythonX.Y -m pytest" which is the safe way to execute
it on all python versions.

> +        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

The other thing I was trying to achieve was to be able to run the
unittest for each python version, so say 2.7, 3.5 & 3.6 are supported
then I was trying to find all of those instead of just one.
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: