[PATCH 3 of 3] .coveragerc: fix reporting of coverage

Thomas De Schampheleire patrickdepinguin at gmail.com
Sun Dec 30 12:56:31 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1546111562 -3600
#      Sat Dec 29 20:26:02 2018 +0100
# Node ID 42d4c56ad79c4a492b8bc607aa070de32d9c6073
# Parent  8a79857fb430eea80556af8d7e7c88810eee7f25
.coveragerc: fix reporting of coverage

Without this change, the HTML report will show all lines specified in
run.omit. As they have 0% coverage, this will negatively impact the overall
coverage percentage calculated in the report.

Note: at this moment, we have an overall 74% test coverage.
Test by installing pytest-cov and running:
    py.test --cov=kallithea --cov-config=.coveragerc --cov-report html
and opening htmlcov/index.html in a browser.

diff --git a/.coveragerc b/.coveragerc
--- a/.coveragerc
+++ b/.coveragerc
@@ -12,6 +12,21 @@ omit =
     kallithea/config/post_receive_tmpl.py
     kallithea/config/pre_receive_tmpl.py
 
+# same omit lines should be present in sections 'run' and 'report'
+[report]
+omit =
+    # the bin scripts are not part of the Kallithea web app
+    kallithea/bin/*
+    # we ship with no active extensions
+    kallithea/config/rcextensions/*
+    # dbmigrate and paster_commands are not part of the Kallithea web app
+    kallithea/lib/dbmigrate/*
+    # the tests themselves should not be part of the coverage report
+    kallithea/tests/*
+    # the scm hooks are not run in the kallithea process
+    kallithea/config/post_receive_tmpl.py
+    kallithea/config/pre_receive_tmpl.py
+
 [paths]
 source =
     kallithea/


More information about the kallithea-general mailing list