diff options
-rw-r--r-- | setup.cfg | 7 | ||||
-rw-r--r-- | setup.py | 40 | ||||
-rw-r--r-- | tox.ini | 5 |
3 files changed, 11 insertions, 41 deletions
@@ -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 @@ -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, ) @@ -2,8 +2,5 @@ envlist = py26, py27, py32, py33, py34, py35, pypy [testenv] -deps = nose - mock - Routes commands = - nosetests -s [] + python setup.py test |