From d3651420ca43a97bcbf42ab65ad6879b20ef7965 Mon Sep 17 00:00:00 2001 From: Matthew Watkins Date: Wed, 30 Nov 2022 09:51:03 +0000 Subject: [PATCH] Chore: Add python coverage report for Sonarcloud Issue-ID: RELENG-4482 Signed-off-by: Matthew Watkins Change-Id: Ieab586c33bb925fdd7faefde168eaad9a19963df --- sonar-project.properties | 1 + tox.ini | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..19ddae8 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.python.coverage.reportPaths=coverage.xml diff --git a/tox.ini b/tox.ini index 2123858..1fde1fb 100644 --- a/tox.ini +++ b/tox.ini @@ -5,13 +5,13 @@ skipsdist = true [testenv:docs] basepython = python3 -deps = +deps = sphinx sphinx-rtd-theme sphinxcontrib-httpdomain recommonmark lfdocs-conf - + commands = sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html echo "Generated docs available in {toxinidir}/docs/_build/html" @@ -31,6 +31,11 @@ commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinid whitelist_externals = sh commands = sh -c 'pip freeze > requirements.txt' +[testenv:coverage] +deps = + pytest + coverage +commands = pytest --cov=o-ran-sc_smo-ves --cov-report=xml --cov-config=tox.ini --cov-branch [coverage:run] # exclude test folder from coverage report @@ -45,8 +50,8 @@ deps= pytest-cov requests jsonschema - kafka-python - gevent + kafka-python + gevent PyYAML pytest-mock flask @@ -62,4 +67,4 @@ deps= # which streams the logs as they come in, rather than saving them # all for the end of tests commands = - pytest --ignore=functionaltest --ignore=collector --cov {toxinidir} --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=70 --junitxml={toxinidir}/tmp/tests.xml \ No newline at end of file + pytest --ignore=functionaltest --ignore=collector --cov {toxinidir} --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=70 --junitxml={toxinidir}/tmp/tests.xml -- 2.16.6