diff --git a/MANIFEST.in b/MANIFEST.in index 91d4395b..21f2572f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include README.rst LICENSE CONTRIBUTORS.rst HISTORY.rst hyper/certs.pem tox.ini - +recursive-include test * diff --git a/setup.py b/setup.py index 3f40ae59..cf5545a3 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,31 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import itertools import os import re import sys -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +from setuptools import setup +from setuptools.command.test import test as TestCommand + + +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 = ['test/'] + + 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) + sys.exit(errno) + # Get the version version_regex = r'__version__ = ["\']([^"\']*)["\']' @@ -83,6 +100,8 @@ def resolve_install_requires(): 'Programming Language :: Python :: Implementation :: CPython', ], install_requires=resolve_install_requires(), + tests_require=['pytest', 'requests', 'mock'], + cmdclass={'test': PyTest}, entry_points={ 'console_scripts': [ 'hyper = hyper.cli:main',