Commit 6afe4a94 authored by Sebastian Ohlmann's avatar Sebastian Ohlmann

integrate python tests

Add parts to configure.ac and Makefile.am. There is now an additional
flag --enable-python-tests. The tests require the pytest package.

The implementation of the test is a bit hacky because it takes
wrapper.so from .libs. This should probably improbed for better
portability.
parent 47e2cb5f
......@@ -629,6 +629,18 @@ wrapper_la_CFLAGS = $(PYTHON_INCLUDE) $(NUMPY_INCLUDE) $(AM_CFLAGS)
python/pyelpa/wrapper.c: python/pyelpa/wrapper.pyx
cython $<
if WITH_PYTHON_TESTS
check_SCRIPTS += check_python.sh
endif
check_python.sh:
@echo "#!/bin/bash" > $@
@echo "export PYTHONPATH=$$PYTHONPATH:$(top_srcdir)/python" >> $@
# this is very hacky... is there a better way to get wrapper.so?
@echo "cp $(top_srcdir)/.libs/wrapper.so $(top_srcdir)/python" >> $@
@echo "pytest $(top_srcdir)/python" >> $@
@echo "rm $(top_srcdir)/python/wrapper.so" >> $@
@chmod +x $@
# test scripts
TASKS ?= 2
......@@ -668,7 +680,8 @@ CLEANFILES = \
complex* \
double_instance* \
*.i \
python/pyelpa/wrapper.c
python/pyelpa/wrapper.c \
check_python.sh
clean-local:
-rm -rf modules/* private_modules/* test_modules/* .fortran_dependencies/*
......
......@@ -1326,6 +1326,29 @@ if test x"${enable_python}" = x"yes"; then
AS_IF([test "$NUMPY_INCLUDE" = "-I"], [AC_MSG_ERROR([cannot get numpy include path.])])
AC_MSG_RESULT([$NUMPY_INCLUDE])
fi
AC_MSG_CHECKING(whether --enable-python-tests is specified)
AC_ARG_ENABLE([python-tests],
AS_HELP_STRING([--enable-python-tests],
[enable python tests, default no.]),
[
if test x"$enableval" = x"yes"; then
enable_python_tests=yes
else
enable_python_tests=no
fi
],
[enable_python_tests=no])
AC_MSG_RESULT([${enable_python_tests}])
AM_CONDITIONAL([WITH_PYTHON_TESTS],[test x"$enable_python_tests" = x"yes"])
if test x"${enable_python_tests}" = x"yes"; then
if test x"${enable_python}" = x"no"; then
AC_MSG_ERROR([Python tests can only be enabled it python is enabled.])
fi
AC_CHECK_PROG([pytest_found], [pytest], [yes], [no])
if test x"$pytest_found" != x"yes" ; then
AC_MSG_ERROR([pytest not found.])
fi
fi
AC_OUTPUT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment