From 27cf5ea897aef83b0c81db0162383a960a91be2f Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Sat, 6 May 2023 08:50:35 +0200 Subject: [PATCH] simplify and document how to measure code coverage This patch configures Coverage.py to measure only the code coverage of kas itself. In addition, we add a note in the devguide how to create and inspect the coverage data. Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- .coveragerc | 4 ++++ docs/devguide.rst | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..695c37e --- /dev/null +++ b/.coveragerc @@ -0,0 +1,4 @@ +[run] +omit = + /usr/* + tests/* diff --git a/docs/devguide.rst b/docs/devguide.rst index ef27a0f..a36f74e 100644 --- a/docs/devguide.rst +++ b/docs/devguide.rst @@ -32,6 +32,18 @@ When you need a proxy to access the internet, add:: to the call. +Measure code coverage +--------------------- + +To measure the code coverage of the unit tests, the ``pytest-cov`` package is +required. On Debian systems, this is provided in ``python3-pytest-cov``. +Once installed, run:: + + $ python3 -m pytest --cov --cov-report html + +The coverage in HTML format can then be found in `htmlcov`. + + Community Resources -------------------