Chore: Add python coverage report for Sonarcloud 75/9875/1
authorMatthew Watkins <mwatkins@linuxfoundation.org>
Wed, 30 Nov 2022 09:51:03 +0000 (09:51 +0000)
committerMatthew Watkins <mwatkins@linuxfoundation.org>
Wed, 30 Nov 2022 09:51:03 +0000 (09:51 +0000)
Issue-ID: RELENG-4482
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Change-Id: Ieab586c33bb925fdd7faefde168eaad9a19963df

sonar-project.properties [new file with mode: 0644]
tox.ini

diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644 (file)
index 0000000..19ddae8
--- /dev/null
@@ -0,0 +1 @@
+sonar.python.coverage.reportPaths=coverage.xml
diff --git a/tox.ini b/tox.ini
index 2123858..1fde1fb 100644 (file)
--- 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