From 61a8840a7152b521bf054c183e45fce45bba4d36 Mon Sep 17 00:00:00 2001 From: David Runge Date: Mon, 1 Nov 2021 22:25:11 +0100 Subject: [PATCH] Add more specific coverage configuration pyproject.toml: Set specific source for `toolscoverage.paths` (as we only provide one module). Set `tools.coverage.run.relative_files` to true (although it is still bug riddled and does not seem to work as advertized in regards to xml output: https://github.com/nedbat/coveragepy/issues/963, https://github.com/nedbat/coveragepy/issues/1147). Set `tool.coverage.xml.output`, so we don't have to provide it on the commandline. Makefile: Do not provide an output file to the coverage xml call, as we do that in configuration now. --- Makefile | 2 +- pyproject.toml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 123859e8..3fb1c70c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ fmt: test: coverage run coverage report - coverage xml -o build/coverage.xml + coverage xml build: ./keyringctl -v build diff --git a/pyproject.toml b/pyproject.toml index 2b64746c..52a39a17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ exclude = ''' )/ ''' -[tool.coverage.path] -source = "." +[tool.coverage.paths] +source = ["libkeyringctl"] [tool.coverage.report] omit = ["tests/*", ".tox/*"] @@ -29,6 +29,10 @@ show_missing = true branch = true command_line = "-m pytest --junit-xml=build/junit-report.xml -vv tests/" omit = ["tests/*", ".tox/*"] +relative_files = true + +[tool.coverage.xml] +output = "build/coverage.xml" [tool.isort] profile = "black"