Package: python-webpy Version: 1:0.37+20120626-1 Severity: important Tags: patch
Hi, It would be nice to run unit tests for this package. I worked out a patch for doing so, and I attached it. Note that the below build-depends-indep has to then be added: Build-Depends-Indep: mysql-client, mysql-server, postgresql, postgresql-client, python-dbutils, python-mysqldb, python-pygresql, python-sqlite, locales-all | language-pack-en Then in debian/rules, we should write: > override_dh_auto_test: > ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) > chmod +x debian/run_tests.sh > set -e ; for pyvers in $(PYTHONS) $(PYTHON3S); do \ > pyvers=$${pyvers} debian/run_tests.sh ; \ > done > endif Please consider adding this before Jessie is out, as tests are important part of Q/A. Cheers, Thomas Goirand (zigo)
#!/bin/sh # # test_mysql.sh - runs libdbi test suite for mysql driver using a temporary # mysql server environment that doesn't distrubs any running MySQL server. # # Copyright (C) 2010 Clint Byrum <cl...@ubuntu.com> # Copyright (C) 2010 Thomas Goirand <z...@debian.org> # # This script is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (at your option) # any later version. # # This script is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to: # The Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301 USA set -e set -x ############################### ### RUN THE MYSQLD INSTANCE ### ############################### MYTEMP_DIR=`mktemp -d` ME=`whoami` # --force is needed because buildd's can't resolve their own hostnames to ips mysql_install_db --no-defaults --datadir=${MYTEMP_DIR} --force --skip-name-resolve --user=${ME} /usr/sbin/mysqld --no-defaults --skip-grant --user=${ME} --socket=${MYTEMP_DIR}/mysql.sock --datadir=${MYTEMP_DIR} --skip-networking & # This sets the path of the MySQL socket for any libmysql-client users, which includes # the ./tests/test_dbi client export MYSQL_UNIX_PORT=${MYTEMP_DIR}/mysql.sock echo -n pinging mysqld. attempts=0 while ! /usr/bin/mysqladmin --socket=${MYTEMP_DIR}/mysql.sock ping ; do sleep 3 attempts=$((attempts+1)) if [ ${attempts} -gt 10 ] ; then echo "skipping test, mysql server could not be contacted after 30 seconds" exit 0 fi done # Create the db mysql --socket=${MYTEMP_DIR}/mysql.sock --execute="CREATE DATABASE webpy;" ############################## ### RUN THE PGSQL INSTANCE ### ############################## MYUSER=`whoami` # initdb refuses to run as root if [ "${MYUSER}" = "root" ] ; then echo dropping root privs.. exec /bin/su postgres -- "$0" "$@" fi PG_MYTMPDIR=`mktemp -d` BINDIR=`pg_config --bindir` # depends on language-pack-en | language-pack-en # because initdb acquires encoding from locale export LC_ALL="en_US.UTF-8" ${BINDIR}/initdb -D ${PG_MYTMPDIR} ${BINDIR}/postgres -D ${PG_MYTMPDIR} -h '' -k ${PG_MYTMPDIR} & attempts=0 while ! [ -e ${PG_MYTMPDIR}/postmaster.pid ] ; do attempts=$((attempts+1)) if [ "${attempts}" -gt 10 ] ; then echo "Exiting test: postgres pid file was not created after 30 seconds" exit 1 fi sleep 3 echo `date`: retrying.. done # Set the env. var so that pgsql client doesn't use networking # libpq uses this for all host params if not explicitly passed export PGHOST=${PG_MYTMPDIR} # Create a new test db createdb webpy ##################### ### RUN THE TESTS ### ##################### # Launch the tests PYTHONPATH=. python$pyvers test/alltests.py ecode=$? ############################################### ### SHUTDOWN MYSQL AND CLEAN ITS TMP FOLDER ### ############################################### /usr/bin/mysqladmin --socket=${MYTEMP_DIR}/mysql.sock shutdown rm -rf ${MYTEMP_DIR} ############################################### ### SHUTDOWN PGSQL AND CLEAN ITS TMP FOLDER ### ############################################### $BINDIR/pg_ctl stop -D ${PG_MYTMPDIR} wait rm -rf ${PG_MYTMPDIR} exit ${ecode}
_______________________________________________ Python-modules-team mailing list Python-modules-team@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team