From b723431540672f4748139900013c0a3207c7c23f Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 14 Jan 2020 11:00:56 +0100 Subject: [PATCH] vici: Run Python tests via tox if available Since we use the serial test harness we can't use AM_TESTS_ENVIRONMENT. The script is necessary for out-of-tree builds. --- configure.ac | 4 +++- src/libcharon/plugins/vici/python/Makefile.am | 7 +++++++ src/libcharon/plugins/vici/python/tox.sh | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 src/libcharon/plugins/vici/python/tox.sh diff --git a/configure.ac b/configure.ac index d7e7a1134..ae950a4d6 100644 --- a/configure.ac +++ b/configure.ac @@ -1345,6 +1345,7 @@ if test x$python_eggs = xtrue; then else AC_SUBST(PYTHONEGGINSTALLDIR, "--install-dir $pythoneggdir") fi + AC_PATH_PROG([TOX], [tox], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) fi AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue]) @@ -1764,7 +1765,8 @@ AM_CONDITIONAL(USE_LEGACY_SYSTEMD, test -n "$systemdsystemunitdir" -a "x$systemd AM_CONDITIONAL(USE_RUBY_GEMS, test x$ruby_gems = xtrue) AM_CONDITIONAL(USE_PYTHON_EGGS, test x$python_eggs = xtrue) AM_CONDITIONAL(USE_PERL_CPAN, test x$perl_cpan = xtrue) -AM_CONDITIONAL(USE_PY_TEST, test "x$PY_TEST" != x) +AM_CONDITIONAL(USE_TOX, test "x$TOX" != x) +AM_CONDITIONAL(USE_PY_TEST, test "x$PY_TEST" != x -a "x$TOX" = x) # ======================== # set global definitions diff --git a/src/libcharon/plugins/vici/python/Makefile.am b/src/libcharon/plugins/vici/python/Makefile.am index 68166f4e1..8a9e6fc26 100644 --- a/src/libcharon/plugins/vici/python/Makefile.am +++ b/src/libcharon/plugins/vici/python/Makefile.am @@ -1,6 +1,7 @@ EXTRA_DIST = LICENSE README.rst MANIFEST.in \ setup.py.in \ tox.ini \ + tox.sh \ vici/test/__init__.py \ vici/test/test_protocol.py \ vici/__init__.py \ @@ -38,6 +39,12 @@ install-exec-local: dist/vici-$(PYTHON_PACKAGE_VERSION)-py$(PYTHON_VERSION).egg dist/vici-$(PYTHON_PACKAGE_VERSION)-py$(PYTHON_VERSION).egg endif +if USE_TOX + TESTS_ENVIRONMENT = export TOX=$(TOX); + AM_TESTS_FD_REDIRECT = 1>&2 + TESTS = tox.sh +endif + if USE_PY_TEST TESTS = $(PY_TEST) endif diff --git a/src/libcharon/plugins/vici/python/tox.sh b/src/libcharon/plugins/vici/python/tox.sh new file mode 100755 index 000000000..1a4f786ea --- /dev/null +++ b/src/libcharon/plugins/vici/python/tox.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +${TOX} -c ${srcdir} --skip-missing-interpreters