From 20d7cc6a73fc4f7cee555db0c5d07f8f1a0bb357 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Thu, 12 Sep 2019 16:09:08 +0200 Subject: [PATCH] mgr: Run python unit tests with tox in the mgr MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: https://tracker.ceph.com/issues/40363 Signed-off-by: Stephan Müller --- src/pybind/mgr/.gitignore | 16 ++++++++++++++++ src/pybind/mgr/CMakeLists.txt | 5 +++++ src/pybind/mgr/requirements.txt | 1 + src/pybind/mgr/tox.ini | 7 +++++++ 4 files changed, 29 insertions(+) create mode 100644 src/pybind/mgr/requirements.txt create mode 100644 src/pybind/mgr/tox.ini 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} -- 2.47.3