From 89385a9d2a193b3daae9ae8f191e6d49153e6e0c Mon Sep 17 00:00:00 2001 From: Tamas Kiss <kiss.tamas@kszk.bme.hu> Date: Sun, 28 Feb 2021 23:09:23 +0100 Subject: [PATCH] Added coverage to test requirements --- .coveragerc | 22 ++++++++++++++++++++++ README.md | 3 ++- requirements-test.txt | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..a661289 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,22 @@ +# .coveragerc to control coverage.py +[run] +branch = True +source = coffee_bot + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # 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 __name__ == .__main__.: + +ignore_errors = True + +[html] +directory = coverage_html_report diff --git a/README.md b/README.md index 66f33d2..8e07c8c 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,5 @@ pip install -r requirements-local.txt ``` The supported IDE for this project is VScode -run tests by `python -m pytest` +To run tests: `python -m pytest` +To run coverage: `coverage run -m pytest; coverage report -m` diff --git a/requirements-test.txt b/requirements-test.txt index 6287ce4..5a23072 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,3 +3,4 @@ mock==4.0.3 pytest==6.2.2 pylint==2.7.1 +coverage==5.5 -- GitLab