From 2dd86c9e3eca6e14a04a821edf3a654f31da7a21 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Tue, 10 Aug 2021 18:06:38 +0200 Subject: [PATCH] pybind/mgr: tox: also test mypy with python 3.7 Signed-off-by: Sebastian Wagner --- src/pybind/mgr/mgr_module.py | 4 +-- src/pybind/mgr/tox.ini | 67 +++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 76fded798e4..131d8feb31b 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -29,13 +29,13 @@ from mgr_util import profile_method if sys.version_info >= (3, 8): from typing import get_args, get_origin else: - def get_args(tp): + def get_args(tp: Any) -> Any: if tp is Generic: return tp else: return getattr(tp, '__args__', ()) - def get_origin(tp): + def get_origin(tp: Any) -> Any: return getattr(tp, '__origin__', None) diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 8664e1ca9db..9709d8edd32 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -60,6 +60,38 @@ setenv = passenv = MYPYPATH basepython = python3 +mypy_args = --config-file=../../mypy.ini + -m alerts + -m balancer + -m cephadm + -m crash + -m dashboard + -m devicehealth + -m diskprediction_local + -m hello + -m influx + -m iostat + -m localpool + -m mds_autoscaler + -m mgr_module + -m mgr_util + -m mirroring + -m nfs + -m orchestrator + -m pg_autoscaler + -m progress + -m prometheus + -m rbd_support + -m rook + -m snap_schedule + -m selftest + -m stats + -m status + -m telegraf + -m telemetry + -m test_orchestrator + -m volumes + -m zabbix deps = cython -rrequirements.txt @@ -71,38 +103,9 @@ deps = types-PyYAML types-jwt commands = - mypy --config-file=../../mypy.ini \ - -m alerts \ - -m balancer \ - -m cephadm \ - -m crash \ - -m dashboard \ - -m devicehealth \ - -m diskprediction_local \ - -m hello \ - -m influx \ - -m iostat \ - -m localpool \ - -m mds_autoscaler \ - -m mgr_module \ - -m mgr_util \ - -m mirroring \ - -m nfs \ - -m orchestrator \ - -m pg_autoscaler \ - -m progress \ - -m prometheus \ - -m rbd_support \ - -m rook \ - -m snap_schedule \ - -m selftest \ - -m stats \ - -m status \ - -m telegraf \ - -m telemetry \ - -m test_orchestrator \ - -m volumes \ - -m zabbix + mypy {[testenv:mypy]mypy_args} + mypy --python-version 3.7 {[testenv:mypy]mypy_args} + [testenv:test] setenv = {[testenv]setenv}