From 857667cbf65573e368e36dff6bc09ba585cc19c1 Mon Sep 17 00:00:00 2001 From: David Fischer <djfische@gmail.com> Date: Sun, 10 Mar 2013 18:50:33 -0700 Subject: [PATCH] Enable running tests from setup.py Unfortunately, this only works if cffi is already installed --- setup.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup.py b/setup.py index b98439cc..3e4ab38a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ #!/usr/bin/env python from setuptools import setup +from setuptools.command.test import test as TestCommand +import sys __about__ = {} @@ -17,6 +19,18 @@ else: ext_modules = [nacl.nacl.ffi.verifier.get_extension()] +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) + + setup( name=__about__["__title__"], version=__about__["__version__"], @@ -45,4 +59,5 @@ setup( ext_modules=ext_modules, zip_safe=False, + cmdclass = {'test': PyTest}, ) -- GitLab