diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000000000000000000000000000000000..a661289d25ca0068d43f9a60f26b0e14a96f5440 --- /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 66f33d26f86c63c9d85628623242c9e700f12080..8e07c8c87474737bb90d3bb789ad34963a836807 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 6287ce4023f96873625c42ea58232eab5bf22e7a..5a230724e7faf82183e19fccef467a23e45b00bb 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