]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: Add mypy testing 31071/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 16 Oct 2019 11:14:36 +0000 (13:14 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Fri, 25 Oct 2019 12:58:41 +0000 (14:58 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/python-common/setup.cfg [new file with mode: 0644]
src/python-common/setup.py
src/python-common/tox.ini

diff --git a/src/python-common/setup.cfg b/src/python-common/setup.cfg
new file mode 100644 (file)
index 0000000..e518626
--- /dev/null
@@ -0,0 +1,5 @@
+[tool:pytest]
+addopts = -vv
+
+[aliases]
+test=pytest
index cf1f661cfd46557169def22ffc2ddfcc14310d52..6692ddab4dda63fb3806ee6854a6df816d324b6c 100644 (file)
@@ -1,6 +1,16 @@
+import sys
+
 from setuptools import setup, find_packages
 
 
+if sys.version_info >= (3,0):
+    mypy = ['mypy', 'pytest-mypy']
+    pytest = 'pytest >=2.1.3'
+else:
+    mypy = []
+    pytest = 'pytest >=2.1.3,<5'
+
+
 with open("README.rst", "r") as fh:
     long_description = fh.read()
 
@@ -20,10 +30,11 @@ setup(
     install_requires=(
         'six',
     ),
+    setup_requires=['pytest-runner'],
     tests_require=[
-        'pytest >=2.1.3',
+        pytest,
         'tox',
-    ],
+    ] + mypy,
     classifiers = [
         'Intended Audience :: Developer',
         'Operating System :: POSIX :: Linux',
index 5af1cc086b3f2d2bed29d76bd27f332ff88c803c..268cd56a71f42b2d1a030cb33451085b2516e1dd 100644 (file)
@@ -3,9 +3,13 @@ envlist = py27, py3, lint
 skip_missing_interpreters = true
 
 [testenv]
-deps=
-  pytest
-commands=py.test -v {posargs:ceph/tests}
+deps=-rrequirements.txt
+
+[testenv:py3]
+commands=python setup.py test --addopts="--mypy --mypy-ignore-missing-imports" {posargs}
+
+[testenv:py27]
+commands=python setup.py test {posargs}
 
 [tool:pytest]
 norecursedirs = .* _* virtualenv