summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.cfg7
-rw-r--r--setup.py40
-rw-r--r--tox.ini5
3 files changed, 11 insertions, 41 deletions
diff --git a/setup.cfg b/setup.cfg
index dea7ae8b..4fffa732 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,16 +6,11 @@ tag = True
[aliases]
clean_egg_info = egg_info -RDb ''
release = clean_egg_info sdist bdist_wheel
+test = pytest
[sdist]
formats = gztar,zip
-[nosetests]
-where = cherrypy
-logging-filter = cherrypy
-verbosity = 2
-nocapture = True
-
[egg_info]
tag_build = .post
tag_date = 1
diff --git a/setup.py b/setup.py
index 8acdcb72..99953824 100644
--- a/setup.py
+++ b/setup.py
@@ -2,11 +2,14 @@ import sys
import re
from distutils.command.install import INSTALL_SCHEMES
from distutils.command.build_py import build_py
-from setuptools.command.test import test as TestCommand
import setuptools
+needs_pytest = {'pytest', 'test'}.intersection(sys.argv)
+pytest_runner = ['pytest_runner'] if needs_pytest else []
+
+
class cherrypy_build_py(build_py):
"""Custom version of build_py that excludes Python-specific modules"""
@@ -22,34 +25,6 @@ class cherrypy_build_py(build_py):
return build_py.build_module(self, module, module_file, package)
-class Tox(TestCommand):
- """
- Command for running tox on `python setup.py test` invocation
-
- Shamelessly stolen from http://stackoverflow.com/a/11547391/595220
- """
- user_options = [('tox-args=', 'a', 'Arguments to pass to tox')]
-
- def initialize_options(self):
- TestCommand.initialize_options(self)
- self.tox_args = None
-
- def finalize_options(self):
- TestCommand.finalize_options(self)
- self.test_args = []
- self.test_suite = True
-
- def run_tests(self):
- # import here, cause outside the eggs aren't loaded
- import tox
- import shlex
- args = self.tox_args
- if args:
- args = shlex.split(self.tox_args)
- errno = tox.cmdline(args=args)
- sys.exit(errno)
-
-
###############################################################################
# arguments for the setup command
###############################################################################
@@ -134,12 +109,13 @@ install_requires = [
]
tests_require = [
- 'tox',
+ 'pytest',
+ 'routes',
+ 'nose',
]
cmd_class = {
'build_py': cherrypy_build_py,
- 'test': Tox, # Enables `python setup.py test` invocation run tox tests
}
if sys.version_info >= (3, 0):
@@ -175,6 +151,8 @@ setup_params = dict(
install_requires=install_requires,
# Enables `python setup.py test` invocation install test dependencies first
tests_require=tests_require,
+ setup_requires=[
+ ] + pytest_runner,
)
diff --git a/tox.ini b/tox.ini
index 2baa1fbd..c046731d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,8 +2,5 @@
envlist = py26, py27, py32, py33, py34, py35, pypy
[testenv]
-deps = nose
- mock
- Routes
commands =
- nosetests -s []
+ python setup.py test