mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
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:
parent
622488155a
commit
2753aac65b
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
23
setup.py
23
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 = []
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user