summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Pentchev <roam@debian.org>2019-01-13 16:36:39 +0200
committerPeter Pentchev <roam@debian.org>2019-01-13 16:36:39 +0200
commit9eba16e77ae895ee2e678fa3b275dd82a1b36ea6 (patch)
treef0d9bcfd2910b46a6ad893060b6e836c6b6bdfe2
parent6d4c30c8c6634665748f290973e947fe50494f79 (diff)
Run the TAP tests in the same way during the build and autopkgtest.
Gbp-Dch: ignore
-rwxr-xr-xdebian/rules5
-rw-r--r--debian/tests/control2
-rwxr-xr-xdebian/tests/tap-python.sh26
3 files changed, 28 insertions, 5 deletions
diff --git a/debian/rules b/debian/rules
index dcd3f0b..cdec530 100755
--- a/debian/rules
+++ b/debian/rules
@@ -86,10 +86,7 @@ ifeq (yes,${BUILD_IMPL_C})
dh_auto_test
endif
ifeq (yes,${BUILD_IMPL_PY})
- set -e; for pyver in $$(pyversions -i -v) $$(py3versions -i -v); do \
- echo "=============== Testing Python $$pyver"; \
- env PYTHONPATH='${PY}' CONFGET="python$$pyver -m confget" TESTDIR='${TESTD}' MANPAGE='${CURDIR}/confget.1' prove '${TESTD}'; \
- done
+ env PYTHONPATH='${PY}' '$D/tests/tap-python.sh'
env TESTDIR='${TESTD}' dh_auto_test -D '${PY}' --buildsystem pybuild -- --test-pytest --test-args '${PY}/unit_tests'
endif
endif
diff --git a/debian/tests/control b/debian/tests/control
index 3d210ee..04c9e1d 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,7 +1,7 @@
Test-Command: if [ -d /usr/share/doc/confget/examples ]; then export MANPAGE='/usr/share/man/man1/confget.1.gz' TESTDIR='/usr/share/doc/confget/examples/tests'; else export TESTDIR='t'; fi; env CONFGET='/usr/bin/confget' prove -v "$TESTDIR"
Depends: @, perl, groff-base
-Test-Command: set -e; if [ -d /usr/share/doc/confget/examples ]; then export MANPAGE='/usr/share/man/man1/confget.1.gz' TESTDIR='/usr/share/doc/confget/examples/tests'; else export TESTDIR='t'; fi; for pyver in $(pyversions -i -v) $(py3versions -i -v); do echo "========== Testing Python $pyver"; env CONFGET="python$pyver -m confget" prove -v "$TESTDIR"; done
+Test-Command: if [ -d /usr/share/doc/confget/examples ]; then export MANPAGE='/usr/share/man/man1/confget.1.gz' TESTDIR='/usr/share/doc/confget/examples/tests'; else export TESTDIR='t'; fi; debian/tests/tap-python.sh
Depends: @, perl, groff-base
Test-Command: adequate confget
diff --git a/debian/tests/tap-python.sh b/debian/tests/tap-python.sh
new file mode 100755
index 0000000..e295f1e
--- /dev/null
+++ b/debian/tests/tap-python.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+# Find the available Python 2.x and 3.x versions.
+
+interpreters=''
+if [ -n "$(command -v pyversions 2>/dev/null)" ]; then
+ for ver in $(pyversions -i -v); do
+ interpreters="$interpreters python$ver"
+ done
+fi
+if [ -n "$(command -v py3versions 2>/dev/null)" ]; then
+ for ver in $(py3versions -i -v); do
+ interpreters="$interpreters python$ver"
+ done
+fi
+
+# Finally run the tests.
+
+for python in $interpreters; do
+ printf -- '\n\n============ Testing %s\n\n' "$python"
+ env CONFGET="$python -m confget" prove t
+done
+
+printf -- '\n\n============ The TAP tests passed for all Python versions\n\n'