Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage to requirements-dev.txt and enable it at pipeline #164

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Config file for automatic testing using github actions
#

name: Unit_Tests

Expand All @@ -24,7 +23,10 @@ jobs:
make format-check
- name: Run pytests (utests/tests)
run: |
make test
make coverage
- name: Check coverage (src/)
run: |
make coverage-check
test:
runs-on: ubuntu-18.04
steps:
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ set-dev:
test:
@echo "Running tests..."
export PYTHONPATH=${PWD}/src && python -m pytest utests/

.PHONY: coverage
coverage:
@echo "Running tests with coverage..."
export PYTHONPATH=${PWD}/src && python -m coverage run --source src/ -m pytest utests/

.PHONY: coverage-check
coverage-check:
@echo "Checking coverage..."
python -m coverage report --fail-under=28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that 28 is the current coverage level, but as it is, it seems to be coming out of nowhere. I believe all code coverage tools have some mechanism to ensure that coverage for a PR hasn't decreased compared to the base branch. Is it possible to use this instead of setting an arbitrary target?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can certainly do that, but for now, it is enough to increase it from time to time.


.PHONY: coverage-all
coverage-all: coverage coverage-check
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

black==22.3.0
pytest==6.2.5
coverage==6.2