diff options
author | koobs <koobs@users.noreply.github.com> | 2014-02-24 21:55:04 +1100 |
---|---|---|
committer | User Koobs <koobs@9-STABLE-amd64.elysium> | 2014-02-25 19:35:48 +1100 |
commit | ff0dd1e000eb4a1552bf59dcdb78db1bd3708721 (patch) | |
tree | b6e52a25416cab617387b42d9607ead3285866c0 /setup.py | |
parent | dae879525fd62f724e2b0d59e26fadf53de3865a (diff) | |
download | cryptography-ff0dd1e000eb4a1552bf59dcdb78db1bd3708721.tar.gz cryptography-ff0dd1e000eb4a1552bf59dcdb78db1bd3708721.tar.bz2 cryptography-ff0dd1e000eb4a1552bf59dcdb78db1bd3708721.zip |
Integrate py.test enabling `python setup.py test`
Integrate py.test according to: https://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands
Enables use of standard python setup.py test command.
Very handy for OS packagers & porters for QA, in this case the FreeBSD Port for cryptography which just landed.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -14,7 +14,7 @@ import os from distutils.command.build import build from setuptools import setup, find_packages - +from setuptools.command.test import test as TestCommand base_dir = os.path.dirname(__file__) @@ -31,6 +31,12 @@ requirements = [ SIX_DEPENDENCY ] +test_requirements = [ + "pytest", + "pretend", + "iso8601" +] + class CFFIBuild(build): """ @@ -63,6 +69,17 @@ class CFFIBuild(build): build.finalize_options(self) +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + 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) + with open(os.path.join(base_dir, "README.rst")) as f: long_description = f.read() @@ -105,11 +122,13 @@ setup( install_requires=requirements, setup_requires=requirements, + tests_require=test_requirements, # for cffi zip_safe=False, ext_package="cryptography", cmdclass={ "build": CFFIBuild, + "test": PyTest, } ) |