Skip to content

Instantly share code, notes, and snippets.

@Hrissimir
Created January 18, 2024 15:47
Show Gist options
  • Save Hrissimir/b1c9e0e0a3497a7b40cb9e82755c342a to your computer and use it in GitHub Desktop.
Save Hrissimir/b1c9e0e0a3497a7b40cb9e82755c342a to your computer and use it in GitHub Desktop.
Sample Coverage config file
[run]
branch = true
data_file = .coverage
parallel = true
source_pkgs =
YOUR_PACKAGE_NAME_GOES_HERE
tests
source =
src/YOUR_PACKAGE_NAME_GOES_HERE
tests
omit =
*__about__.py
*__init__.py
[paths]
YOUR_PACKAGE_NAME_GOES_HERE =
src/YOUR_PACKAGE_NAME_GOES_HERE
*/YOUR-PROJECT-NAME-GOES-HERE/src/YOUR_PACKAGE_NAME_GOES_HERE
tests =
tests
*/YOUR-PROJECT-NAME-GOES-HERE/tests
source =
src
tests
[report]
ignore_errors = true
show_missing = true
# Regexes for lines to exclude from consideration
exclude_also =
# Have to re-enable the standard pragma
no cov
pragma: no cov
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
if TYPE_CHECKING:
# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod
[html]
directory = htmlcov
skip_empty = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment