I have a very simple python package that I build into debian packages using setuptools, cdbs and pycentral:
setup.py:
from setuptools import setup
setup(name='PHPSerialize',
version='1.0',
py_modules=['PHPSerialize'],
test_suite = 'nose.collector'
)
debian/rules:
#!/usr/bin/make -f
DEB_PYTHON_SYSTEM = pycentral
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
Now, is there an easy way to make dpkg-buildpackage execute the unit tests and refuse to create the .deb if the test suite fails?