tests: Remove various unneeded coverage workarounds

Tests now run from root dir so various coverage complications
can be removed.

Also remove the duplicate .coveragerc and rely on pyproject.toml

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This commit is contained in:
Jussi Kukkonen 2024-12-10 20:21:12 +02:00
parent 58bf56f81e
commit 31bb232ca3
4 changed files with 7 additions and 25 deletions

View file

@ -74,14 +74,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ runner.os }} / Python ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
# Use cp workaround to publish coverage reports with relative paths
# FIXME: Consider refactoring the tests to not require the test
# aggregation script being invoked from the `tests` directory, so
# that `.coverage` is written to and .coveragrc can also reside in
# the project root directory as is the convention.
run: |
cp tests/.coverage .
coveralls --service=github --rcfile=tests/.coveragerc
coveralls --service=github
coveralls-fin:
# Always run when all 'tests' jobs have finished even if they failed

View file

@ -153,4 +153,8 @@ exclude_also = [
"raise AssertionError",
# imports for mypy only
"if TYPE_CHECKING",
]
[tool.coverage.run]
omit = [
"tests/*",
]

View file

@ -1,13 +0,0 @@
[run]
branch = True
omit =
*/tests/*
*/site-packages/*
[report]
exclude_lines =
pragma: no cover
def __str__
if __name__ == .__main__.:
@abstractmethod

View file

@ -12,7 +12,7 @@ skipsdist = true
commands =
python3 --version
python3 -m coverage run -m unittest
python3 -m coverage report --rcfile {toxinidir}/pyproject.toml -m --fail-under 97
python3 -m coverage report -m --fail-under 97
deps =
-r{toxinidir}/requirements/test.txt
@ -33,10 +33,9 @@ commands_pre =
commands =
python3 -m coverage run -m unittest
python3 -m coverage report --rcfile {toxinidir}/pyproject.toml -m
python3 -m coverage report -m
[testenv:lint]
changedir = {toxinidir}
deps =
-r{toxinidir}/requirements/lint.txt
--editable {toxinidir}
@ -49,7 +48,6 @@ commands =
mypy {[testenv:lint]lint_dirs}
[testenv:fix]
changedir = {toxinidir}
deps = {[testenv:lint]deps}
commands =
ruff check --fix {[testenv:lint]lint_dirs}
@ -59,6 +57,5 @@ commands =
deps =
-r{toxinidir}/requirements/docs.txt
changedir = {toxinidir}
commands =
sphinx-build -b html docs docs/build/html -W