Package: matplotlib
Version: 1.3.1-1
Severity: wishlist
Tags: patch

matplotlib tends to break very easily, e.g. multiarch tk, tk upgrades or
basically any change in its many many dependencies. In order to help
automatic verification please add autopkgtests.

Attached a patch with some basic tests, they just check functionality of
the tk, qt4 and wxagg backends.
The tk check also runs debug mode which requires adding python-tk-dbg
and python3-tk-dbg build dependencies.

The wxagg backend test crashes under debug mode, I currently do not have
time to investigate that, so it is disabled.

Please note the tests must be made executable after applying the debdiff.
--- matplotlib-1.3.1/debian/control     2013-10-06 22:36:27.000000000 +0200
+++ matplotlib-1.3.1/debian/control     2014-01-11 16:08:33.000000000 +0100
@@ -42,7 +42,9 @@
                python-sphinx (>= 1.0.7+dfsg),
                python-support (>= 1.0.0),
                python-tk (>= 2.5.2-1.1),
+               python-tk-dbg (>= 2.5.2-1.1),
                python3-tk,
+               python3-tk-dbg,
                python-tornado,
                python3-tornado,
                python-tz,
@@ -63,6 +65,7 @@
 Homepage: http://matplotlib.org/
 Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/matplotlib/trunk/
 Vcs-Browser: 
http://anonscm.debian.org/viewvc/python-modules/packages/matplotlib/trunk/
+XS-Testsuite: autopkgtest
 
 Package: python-matplotlib
 Architecture: any
diff -Nru matplotlib-1.3.1/debian/tests/backend-base 
matplotlib-1.3.1/debian/tests/backend-base
--- matplotlib-1.3.1/debian/tests/backend-base  1970-01-01 01:00:00.000000000 
+0100
+++ matplotlib-1.3.1/debian/tests/backend-base  2014-01-09 02:50:58.000000000 
+0100
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -efu
+
+DEBUG=${DEBUG:-yes}
+
+export HOME=$ADTTMP
+cd $ADTTMP
+
+echo "=== $BACKEND ==="
+
+cat << EOF > test.py
+import matplotlib
+matplotlib.use("$BACKEND")
+import matplotlib.pyplot as plt
+
+plt.ion()
+plt.plot(range(5), range(5))
+plt.show()
+plt.gca().figure.canvas.draw()
+plt.savefig('test.png')
+EOF
+
+for py in $pys; do
+    echo "=== $py ==="
+    xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" $py test.py
+    rm test.png
+
+    if [ "$DEBUG" = "yes" ]; then
+      echo "=== $py-dbg ==="
+      xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" $py-dbg test.py 2>&1
+      rm test.png
+    fi
+done
+
diff -Nru matplotlib-1.3.1/debian/tests/control 
matplotlib-1.3.1/debian/tests/control
--- matplotlib-1.3.1/debian/tests/control       1970-01-01 01:00:00.000000000 
+0100
+++ matplotlib-1.3.1/debian/tests/control       2014-01-09 02:37:16.000000000 
+0100
@@ -0,0 +1,8 @@
+Tests: tkagg
+Depends: xauth, xvfb, python-matplotlib, python-matplotlib-dbg, python-tk, 
python-tk-dbg, python-numpy, python-numpy-dbg, python3-matplotlib, 
python3-matplotlib-dbg, python3-tk, python3-tk-dbg, python3-numpy, 
python3-numpy-dbg
+
+Tests: qt4agg
+Depends: xauth, xvfb, python-matplotlib, python-matplotlib-dbg, python-qt4, 
python-qt4-dbg, python-numpy, python-numpy-dbg, python3-matplotlib, 
python3-matplotlib-dbg, python3-pyqt4, python3-pyqt4-dbg, python3-numpy, 
python3-numpy-dbg
+
+Tests: wxagg
+Depends: xauth, xvfb, python-matplotlib, python-matplotlib-dbg, 
python-wxgtk2.8, python-wxgtk2.8-dbg, python-numpy, python-numpy-dbg
diff -Nru matplotlib-1.3.1/debian/tests/qt4agg 
matplotlib-1.3.1/debian/tests/qt4agg
--- matplotlib-1.3.1/debian/tests/qt4agg        1970-01-01 01:00:00.000000000 
+0100
+++ matplotlib-1.3.1/debian/tests/qt4agg        2014-01-09 02:30:23.000000000 
+0100
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -efu
+
+pys="$(pyversions -r 2>/dev/null) $(py3versions -r 2>/dev/null)"
+
+BACKEND="Qt4Agg" pys=$pys debian/tests/backend-base
diff -Nru matplotlib-1.3.1/debian/tests/tkagg 
matplotlib-1.3.1/debian/tests/tkagg
--- matplotlib-1.3.1/debian/tests/tkagg 1970-01-01 01:00:00.000000000 +0100
+++ matplotlib-1.3.1/debian/tests/tkagg 2014-01-09 02:30:24.000000000 +0100
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -efu
+
+pys="$(pyversions -r 2>/dev/null) $(py3versions -r 2>/dev/null)"
+
+BACKEND="TkAgg" pys=$pys debian/tests/backend-base
diff -Nru matplotlib-1.3.1/debian/tests/wxagg 
matplotlib-1.3.1/debian/tests/wxagg
--- matplotlib-1.3.1/debian/tests/wxagg 1970-01-01 01:00:00.000000000 +0100
+++ matplotlib-1.3.1/debian/tests/wxagg 2014-01-09 02:56:15.000000000 +0100
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -efu
+
+pys="$(pyversions -r 2>/dev/null)"
+
+# todo check why debug fails
+BACKEND="WXAgg" pys=$pys DEBUG=no debian/tests/backend-base 2>&1

Reply via email to