mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
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.
This commit is contained in:
parent
dae879525f
commit
ff0dd1e000
1 changed files with 20 additions and 1 deletions
21
setup.py
21
setup.py
|
|
@ -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,
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue