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"
|
- "3.4"
|
||||||
- "pypy"
|
- "pypy"
|
||||||
install:
|
install:
|
||||||
- "pip install -r requirements_dev.txt"
|
|
||||||
- "python setup.py install"
|
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install aiohttp; fi
|
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install aiohttp; fi
|
||||||
script: py.test -x tests/
|
script: python setup.py test
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
py==1.4.19
|
py==1.4.22
|
||||||
pytest==2.5.1
|
pytest==2.6.0
|
||||||
pytest-cov==1.6
|
pytest-cov==1.7.0
|
||||||
sphinx
|
sphinx
|
||||||
sphinx_rtd_theme
|
sphinx_rtd_theme
|
||||||
|
|||||||
23
setup.py
23
setup.py
@ -5,7 +5,9 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from setuptools import setup, Command
|
from setuptools import setup
|
||||||
|
from setuptools.command.test import test as TestCommand
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from gunicorn import __version__
|
from gunicorn import __version__
|
||||||
@ -46,25 +48,26 @@ fname = os.path.join(os.path.dirname(__file__), 'requirements_dev.txt')
|
|||||||
with open(fname) as f:
|
with open(fname) as f:
|
||||||
tests_require = list(map(lambda l: l.strip(), f.readlines()))
|
tests_require = list(map(lambda l: l.strip(), f.readlines()))
|
||||||
|
|
||||||
class PyTest(Command):
|
class PyTest(TestCommand):
|
||||||
user_options = [
|
user_options = [
|
||||||
("cov", None, "measure coverage")
|
("cov", None, "measure coverage")
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
|
TestCommand.initialize_options(self)
|
||||||
self.cov = None
|
self.cov = None
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
pass
|
TestCommand.finalize_options(self)
|
||||||
|
self.test_args = ['tests']
|
||||||
def run(self):
|
|
||||||
import subprocess
|
|
||||||
basecmd = [sys.executable, '-m', 'pytest']
|
|
||||||
if self.cov:
|
if self.cov:
|
||||||
basecmd += ['--cov', 'gunicorn']
|
self.test_args += ['--cov', 'gunicorn']
|
||||||
errno = subprocess.call(basecmd + ['tests'])
|
self.test_suite = True
|
||||||
raise SystemExit(errno)
|
|
||||||
|
|
||||||
|
def run_tests(self):
|
||||||
|
import pytest
|
||||||
|
errno = pytest.main(self.test_args)
|
||||||
|
sys.exit(errno)
|
||||||
|
|
||||||
REQUIREMENTS = []
|
REQUIREMENTS = []
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user