From: Stephan Müller Date: Thu, 12 Sep 2019 14:09:08 +0000 (+0200) Subject: mgr: Run python unit tests with tox in the mgr X-Git-Tag: v15.1.0~942^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=20d7cc6a73fc4f7cee555db0c5d07f8f1a0bb357;p=ceph.git mgr: Run python unit tests with tox in the mgr Fixes: https://tracker.ceph.com/issues/40363 Signed-off-by: Stephan Müller --- diff --git a/src/pybind/mgr/.gitignore b/src/pybind/mgr/.gitignore index fcdcddd51dda..642616e09dfd 100644 --- a/src/pybind/mgr/.gitignore +++ b/src/pybind/mgr/.gitignore @@ -1 +1,17 @@ proxy.conf.json + +# tox related +.coverage* +htmlcov +.tox +coverage.xml +junit*xml +.cache + +# IDE +.vscode +*.egg +.env + +# virtualenv +venv diff --git a/src/pybind/mgr/CMakeLists.txt b/src/pybind/mgr/CMakeLists.txt index ef07dac77c39..56d5c0a9c76a 100644 --- a/src/pybind/mgr/CMakeLists.txt +++ b/src/pybind/mgr/CMakeLists.txt @@ -5,6 +5,11 @@ add_subdirectory(insights) add_subdirectory(ansible) add_subdirectory(orchestrator_cli) +if(WITH_TESTS) + include(AddCephTest) + add_tox_test(mgr ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + # Location needs to match default setting for mgr_module_path, currently: # OPTION(mgr_module_path, OPT_STR, CEPH_PKGLIBDIR "/mgr") install(DIRECTORY diff --git a/src/pybind/mgr/requirements.txt b/src/pybind/mgr/requirements.txt new file mode 100644 index 000000000000..86a816f125fb --- /dev/null +++ b/src/pybind/mgr/requirements.txt @@ -0,0 +1 @@ +pytest-cov==2.7.1 diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini new file mode 100644 index 000000000000..a9e837082956 --- /dev/null +++ b/src/pybind/mgr/tox.ini @@ -0,0 +1,7 @@ +[tox] +envlist = py3 +skipsdist = true + +[testenv] +deps = -rrequirements.txt +commands = pytest --cov --cov-append --cov-report=term --doctest-modules mgr_util.py {posargs}