Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis CI migration and packaging improvements #2990

Merged
merged 13 commits into from
May 17, 2018
Prev Previous commit
Next Next commit
Use pytest-runner in dist setup
  • Loading branch information
webknjaz committed May 14, 2018
commit 9f6f89195a5fc18ab462f5e6621bc6bef20479b5
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[aliases]
test = pytest

[metadata]
license_file = LICENSE.txt

Expand Down
20 changes: 7 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
DistutilsPlatformError)

from setuptools import Extension, setup
from setuptools.command.test import test as TestCommand


if sys.version_info < (3, 5, 3):
Expand Down Expand Up @@ -85,17 +84,11 @@ def read(f):
return (here / f).read_text('utf-8').strip()


class PyTest(TestCommand):
user_options = []
NEEDS_PYTEST = {'pytest', 'test'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if NEEDS_PYTEST else []

def run(self):
import subprocess
errno = subprocess.call([sys.executable, '-m', 'pytest', 'tests'])
raise SystemExit(errno)


tests_require = install_requires + ['pytest', 'gunicorn',
'pytest-timeout', 'async-generator']
tests_require = ['pytest', 'gunicorn',
'pytest-timeout', 'async-generator']


args = dict(
Expand Down Expand Up @@ -140,10 +133,11 @@ def run(self):
python_requires='>=3.5.3',
install_requires=install_requires,
tests_require=tests_require,
setup_requires=pytest_runner,
include_package_data=True,
ext_modules=extensions,
cmdclass=dict(build_ext=ve_build_ext,
test=PyTest))
cmdclass=dict(build_ext=ve_build_ext),
)

try:
setup(**args)
Expand Down