Use .coveragerc to omit directories

We can use the omit option instead of adding --omit argument, so that
we can run coverage commands outside of tox easily. Also this fixes
the inconsistent omit used in some coverage commands in tox.

Change-Id: I1efa406401c2e8a6b705daef4921b2dec7d55f2e
(cherry picked from commit 54bddd5b9f)
This commit is contained in:
Takashi Kajinami 2024-01-25 23:47:58 +09:00 committed by Luis Tomas Bolivar
parent b36bfdc6cf
commit 52e10d39cf
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,9 @@
[run]
branch = True
source = ovn_bgp_agent
omit = ovn_bgp_agent/tests/*,
ovn_bgp_agent/privileged/linux_net.py,
ovn_bgp_agent/utils/linux_net.py
[report]
ignore_errors = True

View File

@ -42,9 +42,9 @@ setenv =
commands =
stestr run --exclude-regex ".tests.functional" {posargs}
coverage combine
coverage html -d cover --omit='ovn_bgp_agent/tests/*'
coverage xml -o cover/coverage.xml --omit='ovn_bgp_agent/tests/*'
coverage report --fail-under=82 --skip-covered --omit='ovn_bgp_agent/tests/*,ovn_bgp_agent/privileged/linux_net.py,ovn_bgp_agent/utils/linux_net.py'
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report --fail-under=82 --skip-covered
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt