[PATCH 2 of 2 logilab-mtconverter] Run test during Debian package build and add autopkgtest support

Jérémy Bobbio jeremy.bobbio at irq7.fr
Wed Jun 5 15:01:06 CEST 2019


# HG changeset patch
# User Jérémy Bobbio <jeremy.bobbio at irq7.fr>
# Date 1559739338 -7200
#      Wed Jun 05 14:55:38 2019 +0200
# Node ID 79132656e321c0381fcf4945f2c4f892e63bd459
# Parent  fad960015fd7e9108483c23b590c03326efbce07
Run test during Debian package build and add autopkgtest support

We now ship the full test directory with the Python package.

This allows to run the test suite during Debian package build, and add
autopkgtest support that will run testsuite against the installed
package.

diff -r fad960015fd7 -r 79132656e321 MANIFEST.in
--- a/MANIFEST.in	Wed Jun 05 14:12:42 2019 +0200
+++ b/MANIFEST.in	Wed Jun 05 14:55:38 2019 +0200
@@ -1,5 +1,5 @@
 include ChangeLog
 include COPYING
 include COPYING.LESSER
-include test/data.txt.gz test/hello.odt
+recursive-include test *
 include __pkginfo__.py
diff -r fad960015fd7 -r 79132656e321 debian/changelog
--- a/debian/changelog	Wed Jun 05 14:12:42 2019 +0200
+++ b/debian/changelog	Wed Jun 05 14:55:38 2019 +0200
@@ -6,6 +6,8 @@
     - Use PYBUILD_NAME instead of debian/*.install files.
     - Update minimum Python versions to supported ones.
     - Update Standards-Version to 4.3.0.
+    - Run testsuite at build time.
+    - Add autopkgtest support to run testsuite against the installed package.
 
  -- Jérémy Bobbio <jeremy.bobbio at irq7.fr>  Wed, 05 Jun 2019 14:07:32 +0200
 
diff -r fad960015fd7 -r 79132656e321 debian/control
--- a/debian/control	Wed Jun 05 14:12:42 2019 +0200
+++ b/debian/control	Wed Jun 05 14:55:38 2019 +0200
@@ -10,6 +10,16 @@
  python3-all,
  python-setuptools,
  python3-setuptools,
+ python-six,
+ python3-six,
+ python-html2text,
+ python3-html2text,
+ python-lxml,
+ python3-lxml,
+ python-pygments,
+ python3-pygments,
+ python-logilab-common,
+ python3-logilab-common
 X-Python-Version: >= 2.7
 X-Python3-Version: >= 3.4
 Standards-Version: 4.3.0
diff -r fad960015fd7 -r 79132656e321 debian/pybuild.testfiles
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/pybuild.testfiles	Wed Jun 05 14:55:38 2019 +0200
@@ -0,0 +1,2 @@
+test
+logilab_mtconverter.egg-info
diff -r fad960015fd7 -r 79132656e321 debian/rules
--- a/debian/rules	Wed Jun 05 14:12:42 2019 +0200
+++ b/debian/rules	Wed Jun 05 14:55:38 2019 +0200
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 export PYBUILD_NAME = logilab-mtconverter
-export PYBUILD_DISABLE = test
+export PYBUILD_TEST_ARGS = -v -s test -p 'unittest*py'
 
 %:
 	dh $@ --with python2,python3 --buildsystem=pybuild
diff -r fad960015fd7 -r 79132656e321 debian/tests/control
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/tests/control	Wed Jun 05 14:55:38 2019 +0200
@@ -0,0 +1,4 @@
+Tests: unittest
+Depends:
+ @, @builddeps@, poppler-utils, python-pil, python3-pil, texlive-latex-base
+Restrictions: allow-stderr
diff -r fad960015fd7 -r 79132656e321 debian/tests/unittest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/tests/unittest	Wed Jun 05 14:55:38 2019 +0200
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+set -x
+
+### Setup tests
+
+cp -r test "$AUTOPKGTEST_TMP"
+
+### Run tests
+
+for py in $(pyversions -r 2>/dev/null) $(py3versions -r 2>/dev/null); do
+	cd "$AUTOPKGTEST_TMP"
+	echo "Testing with $py:"
+	$py -m unittest discover -s test -p 'unittest_*.py' -v
+done


More information about the cubicweb-devel mailing list