From 615ec401952623f8a4b78014f2d426f41f24fff3 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Tue, 29 Oct 2019 16:36:01 +0100 Subject: [PATCH] python-common: move pytest integration from setup.py to tox.ini Signed-off-by: Sebastian Wagner --- src/python-common/requirements.txt | 5 +++++ src/python-common/setup.cfg | 5 ----- src/python-common/setup.py | 32 ------------------------------ src/python-common/tox.ini | 11 +++++----- 4 files changed, 11 insertions(+), 42 deletions(-) delete mode 100644 src/python-common/setup.cfg diff --git a/src/python-common/requirements.txt b/src/python-common/requirements.txt index ffe2fce49895..c935efe169a0 100644 --- a/src/python-common/requirements.txt +++ b/src/python-common/requirements.txt @@ -1 +1,6 @@ six +pytest >=2.1.3,<5; python_version < '3.5' +mock; python_version < '3.3' +mypy; python_version >= '3' +pytest-mypy; python_version >= '3' +pytest >= 2.1.3; python_version >= '3' diff --git a/src/python-common/setup.cfg b/src/python-common/setup.cfg deleted file mode 100644 index 8106df939e55..000000000000 --- a/src/python-common/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[tool:pytest] -addopts = -vv --log-cli-level=DEBUG - -[aliases] -test=pytest diff --git a/src/python-common/setup.py b/src/python-common/setup.py index 3dd16da7d797..48daee6dee4d 100644 --- a/src/python-common/setup.py +++ b/src/python-common/setup.py @@ -1,37 +1,10 @@ -import sys - from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand - - -if sys.version_info >= (3,0): - mypy = ['mypy', 'pytest-mypy'] - pytest = ['pytest >=2.1.3'] -else: - mypy = [] - pytest = ['pytest >=2.1.3,<5', 'mock'] with open("README.rst", "r") as fh: long_description = fh.read() -class PyTest(TestCommand): - user_options = [('addopts=', 'a', "Arguments to pass to py.test")] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.addopts = [] - - def run_tests(self): - # import here, cause outside the eggs aren't loaded - import pytest - - args = self.addopts.split() if isinstance(self.addopts, str) else self.addopts - errno = pytest.main(args) - sys.exit(errno) - - setup( name='ceph', version='1.0.0', @@ -44,14 +17,9 @@ setup( keywords='ceph', url="https://github.com/ceph/ceph", zip_safe = False, - cmdclass={'pytest': PyTest}, install_requires=( 'six', ), - tests_require=[ - 'tox', - 'pyyaml' - ] + mypy + pytest, classifiers = [ 'Intended Audience :: Developer', 'Operating System :: POSIX :: Linux', diff --git a/src/python-common/tox.ini b/src/python-common/tox.ini index 268cd56a71f4..09d53d7e51b8 100644 --- a/src/python-common/tox.ini +++ b/src/python-common/tox.ini @@ -2,14 +2,15 @@ envlist = py27, py3, lint skip_missing_interpreters = true -[testenv] -deps=-rrequirements.txt - [testenv:py3] -commands=python setup.py test --addopts="--mypy --mypy-ignore-missing-imports" {posargs} +deps= + -rrequirements.txt +commands=pytest --mypy --mypy-ignore-missing-imports --log-cli-level=DEBUG {posargs} [testenv:py27] -commands=python setup.py test {posargs} +deps= + -rrequirements.txt +commands=pytest --log-cli-level=DEBUG {posargs} [tool:pytest] norecursedirs = .* _* virtualenv -- 2.47.3