mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
integrate pytest with setup.py
This commit is contained in:
parent
674c1ac802
commit
1505e29248
6
Makefile
6
Makefile
@ -1,13 +1,13 @@
|
||||
build:
|
||||
virtualenv --no-site-packages .
|
||||
bin/python setup.py develop
|
||||
bin/pip install -r requirements_dev.txt
|
||||
bin/pip install -r requirements_dev.txt
|
||||
|
||||
test:
|
||||
./bin/py.test tests/
|
||||
bin/python setup.py test
|
||||
|
||||
coverage:
|
||||
./bin/py.test --cov gunicorn tests/
|
||||
bin/python setup.py test --cov
|
||||
|
||||
clean:
|
||||
@rm -rf .Python bin lib include man build html
|
||||
|
||||
30
setup.py
30
setup.py
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import setup, find_packages, Command
|
||||
import sys
|
||||
|
||||
from gunicorn import __version__
|
||||
@ -34,6 +34,31 @@ CLASSIFIERS = [
|
||||
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
|
||||
long_description = f.read()
|
||||
|
||||
# read dev requirements
|
||||
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):
|
||||
user_options = [
|
||||
("cov", None, "measure coverage")
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.cov = None
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
import sys,subprocess
|
||||
basecmd = [sys.executable, '-m', 'py.test']
|
||||
if self.cov:
|
||||
basecmd += ['--cov', 'gunicorn']
|
||||
errno = subprocess.call(basecmd + ['tests'])
|
||||
raise SystemExit(errno)
|
||||
|
||||
|
||||
setup(
|
||||
name = 'gunicorn',
|
||||
version = __version__,
|
||||
@ -50,6 +75,9 @@ setup(
|
||||
packages = find_packages(exclude=['examples', 'tests']),
|
||||
include_package_data = True,
|
||||
|
||||
tests_require = tests_require,
|
||||
cmdclass = {'test': PyTest},
|
||||
|
||||
entry_points="""
|
||||
|
||||
[console_scripts]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user