Fix PyTest class in setup.py.

It should be subclass of `setuptools.command.test`. Also, use it in
.travis.yml.
This commit is contained in:
WooParadog 2014-07-30 18:00:30 +08:00 committed by Berker Peksag
parent 622488155a
commit 2753aac65b
3 changed files with 17 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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 = []