summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2015-04-15 12:08:54 -0400
committerHynek Schlawack <hs@ox.cx>2015-04-15 12:08:54 -0400
commitf982efda6ad9a4b4b0973b4c811cd8f6905a1cd8 (patch)
treed81f765b87ae74cd0ffb509e3facd30041ea48dd /setup.py
parent48ceed5963238a41ece50693249d65e1dc216071 (diff)
downloadpyopenssl-f982efda6ad9a4b4b0973b4c811cd8f6905a1cd8.tar.gz
Integrate py.test with setup.py test
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index c376f87..c4fbbd5 100755
--- a/setup.py
+++ b/setup.py
@@ -8,12 +8,36 @@
Installation script for the OpenSSL module
"""
+import sys
+
from setuptools import setup
+from setuptools.command.test import test as TestCommand
# XXX Deduplicate this
__version__ = '0.15.1'
+
+class PyTest(TestCommand):
+ user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
+
+ def initialize_options(self):
+ TestCommand.initialize_options(self)
+ self.pytest_args = None
+
+ 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.pytest_args or [] +
+ ["OpenSSL"])
+ sys.exit(errno)
+
+
setup(name='pyOpenSSL', version=__version__,
packages = ['OpenSSL'],
package_dir = {'OpenSSL': 'OpenSSL'},
@@ -75,4 +99,10 @@ High-level wrapper around a subset of the OpenSSL library, includes
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Networking',
],
- test_suite="OpenSSL")
+ test_suite="OpenSSL",
+ tests_require=[
+ "pytest",
+ ],
+ cmdclass={
+ "test": PyTest,
+ })