diff --git a/.travis.yml b/.travis.yml index 6c2324ba..00f396aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,8 @@ python: - "3.4" - "pypy" install: - - "pip install -r requirements_dev.txt" - - "python setup.py install" - if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install aiohttp; fi -script: py.test -x tests/ +script: python setup.py test branches: only: - master diff --git a/requirements_dev.txt b/requirements_dev.txt index 5dabec08..562dd235 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,5 @@ -py==1.4.19 -pytest==2.5.1 -pytest-cov==1.6 +py==1.4.22 +pytest==2.6.0 +pytest-cov==1.7.0 sphinx sphinx_rtd_theme diff --git a/setup.py b/setup.py index f5387340..212b157d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,9 @@ import os -from setuptools import setup, Command +from setuptools import setup +from setuptools.command.test import test as TestCommand + import sys from gunicorn import __version__ @@ -46,25 +48,26 @@ fname = os.path.join(os.path.dirname(__file__), 'requirements_dev.txt') with open(fname) as f: tests_require = list(map(lambda l: l.strip(), f.readlines())) -class PyTest(Command): +class PyTest(TestCommand): user_options = [ ("cov", None, "measure coverage") ] def initialize_options(self): + TestCommand.initialize_options(self) self.cov = None def finalize_options(self): - pass - - def run(self): - import subprocess - basecmd = [sys.executable, '-m', 'pytest'] + TestCommand.finalize_options(self) + self.test_args = ['tests'] if self.cov: - basecmd += ['--cov', 'gunicorn'] - errno = subprocess.call(basecmd + ['tests']) - raise SystemExit(errno) + self.test_args += ['--cov', 'gunicorn'] + self.test_suite = True + def run_tests(self): + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) REQUIREMENTS = []