[med-svn] [python-ruffus] 01/01: Split snipped to run unit test from test script to enable running it at package build time as well; keep silence if test is OK and print log only if test failed

Andreas Tille tille at debian.org
Thu Feb 5 13:49:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository python-ruffus.

commit b0cdcecf084321a24d3246a3fa2cf2679ffff2e6
Author: Andreas Tille <tille at debian.org>
Date:   Thu Feb 5 14:42:43 2015 +0100

    Split snipped to run unit test from test script to enable running it at package build time as well; keep silence if test is OK and print log only if test failed
---
 debian/tests/control               |  2 +-
 debian/tests/run-unit-test         | 23 ++++++++++-------------
 debian/tests/run-unit-test-wrapper | 15 +++++++++++++++
 3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/debian/tests/control b/debian/tests/control
index d2aa55a..e001c43 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,3 +1,3 @@
-Tests: run-unit-test
+Tests: run-unit-test-wrapper
 Depends: @
 Restrictions: allow-stderr
diff --git a/debian/tests/run-unit-test b/debian/tests/run-unit-test
index 23a1d05..71e9a40 100644
--- a/debian/tests/run-unit-test
+++ b/debian/tests/run-unit-test
@@ -1,14 +1,6 @@
 #!/bin/sh -e
 
-pkg=python-ruffus
-if [ "$ADTTMP" = "" ] ; then
-  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
-fi
-cd $ADTTMP
-cp -a /usr/share/doc/python-ruffus-doc/test/* .
-find . -type f -name "*.gz" -exec gunzip \{\} \;
-chmod +x [a-z]*.py
-exportLC_ALL=C.UTF-8
+export LC_ALL=C.UTF-8
 # prepare data used in tests:
 for pi in $(pyversions -i) $(py3versions -i); do
   ${pi} test_filesre_split_and_combine.py --start_again
@@ -22,12 +14,17 @@ for pi in $(pyversions -i) $(py3versions -i); do
       echo "---> skipping $tst since no cluster is setup automatically <---"
       continue
     fi
-    echo "------------> ${pi} $tst <-----------"
+    logfile=`basename $tst .py`.log
     if [ "$tst" = "test_N_x_M_and_collate.py" ] ; then
-      ${pi} test_N_x_M_and_collate.py --debug
+      ${pi} test_N_x_M_and_collate.py --debug 2>&1 | tee > $logfile
     else
-      ${pi} $tst
+      ${pi} $tst 2>&1 | tee > $logfile
+    fi
+    if grep -q "^FAIL" $logfile ; then
+      echo "------------> ${pi} $tst ===> failed"
+      cat $logfile
+    else
+      echo "------------> ${pi} $tst ===> OK"
     fi
   done
 done
-# rm -f $ADTTMP/*
diff --git a/debian/tests/run-unit-test-wrapper b/debian/tests/run-unit-test-wrapper
new file mode 100644
index 0000000..4d06689
--- /dev/null
+++ b/debian/tests/run-unit-test-wrapper
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+pkg=python-ruffus
+curdir=`pwd`
+if [ "$ADTTMP" = "" ] ; then
+  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
+fi
+cd $ADTTMP
+cp -a /usr/share/doc/python-ruffus-doc/test/* .
+find . -type f -name "*.gz" -exec gunzip \{\} \;
+chmod +x [a-z]*.py
+
+. ${curdir}/run-unit-test
+
+# rm -f $ADTTMP/*

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-ruffus.git



More information about the debian-med-commit mailing list