From: Michal Vyskocil Subject: Py.test integration ... to allow python setup.py test --- setup.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) Index: cffi-0.8/setup.py =================================================================== --- cffi-0.8.orig/setup.py +++ cffi-0.8/setup.py @@ -2,6 +2,19 @@ import sys, os import subprocess import errno +# http://pytest.org/latest/goodpractises.html +from setuptools.command.test import test as TestCommand + +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = ['testing/', ] + self.test_suite = True + def run_tests(self): + #import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) sources = ['c/_cffi_backend.c'] libraries = ['ffi'] @@ -132,5 +145,7 @@ Contact install_requires=[ 'pycparser', - ] + ], + tests_require=['pytest'], + cmdclass = {'test': PyTest}, )