[arch-projects] [pyalpm][PATCH add tests] 4/4] Add `python setup.py test`
Add the ability to run the unittests from setup.py. Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl> --- setup.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 44507a9..21196f9 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- import os +import subprocess +from distutils.cmd import Command from distutils.core import Extension, setup os.putenv('LC_CTYPE', 'en_US.UTF-8') @@ -36,6 +38,21 @@ alpm = Extension('pyalpm', 'src/util.h', ]) +class TestCommand(Command): + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + raise SystemExit( + subprocess.call(['nosetests', + 'tests'])) + + setup(name = 'pyalpm', version = pyalpm_version, description = 'libalpm bindings for Python 3', @@ -45,6 +62,9 @@ setup(name = 'pyalpm', packages = ["pycman"], scripts = ["scripts/lsoptdepends"] + ["scripts/pycman-" + i for i in ['database', 'deptest', 'query', 'remove', 'sync', 'upgrade', 'version']], - ext_modules = [alpm]) + ext_modules = [alpm], + cmdclass = { + 'test': TestCommand + }) # vim: set ts=4 sw=4 et tw=0: -- 2.10.1
participants (1)
-
Jelle van der Waa