Skip to content

Commit aac9275

Browse files
Added make target for test coverage and codecov.yml
1 parent 3197d58 commit aac9275

File tree

7 files changed

+49
-0
lines changed

7 files changed

+49
-0
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ jobs:
3333
run: make package-install
3434
- name: Run tests
3535
run: make test
36+
- name: Run tests and collect coverage
37+
run: make test-coverage
38+
- name: Codecov
39+
uses: codecov/[email protected]
40+
with:
41+
- flags: all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pip-delete-this-directory.txt
4141
htmlcov/
4242
.tox/
4343
.nox/
44+
coverage/
4445
.coverage
4546
.coverage.*
4647
.cache

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ test: $(TESTPACKAGES) ## Run tests on all packages
3030
$(TESTPACKAGES):
3131
$(MAKE) -C $(@:test-%=%) test
3232

33+
test-coverage: $(TESTPACKAGES) ## Run tests coverage on all packages
34+
$(TESTPACKAGES):
35+
$(MAKE) -C $(@:test-%=%) test-coverage
36+
3337
clean: $(CLEANPACKAGES) ## Remove all build, test, coverage and Python artifacts
3438
$(CLEANPACKAGES):
3539
$(MAKE) -C $(@:clean-%=%) clean

cli/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ zip_safe = False
3131
include_package_data = True
3232
install_requires =
3333
pytest
34+
pytest-cov
3435
click>=8.0.4
3536
pyyaml>=6.0
3637
click-option-group
@@ -46,6 +47,7 @@ dev =
4647
pre-commit
4748
pydocstyle
4849
pytest
50+
pytest-cov
4951
pytest_mock
5052
yamllint
5153
pylint

codecov.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
coverage:
2+
status:
3+
project: off
4+
patch: off
5+
6+
flag_management:
7+
default_rules:
8+
carryforward: true
9+
individual_flags:
10+
- name: all
11+
paths:
12+
- cli/
13+
- core/
14+
statuses:
15+
- type: project
16+
target: 100%
17+
threshold: 1%
18+
- name: cli
19+
paths:
20+
- cli/
21+
statuses:
22+
- type: project
23+
target: 70
24+
threshold: 1%
25+
- name: core
26+
paths:
27+
- core/
28+
statuses:
29+
- type: project
30+
target: 100
31+
threshold: 1%

core/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ zip_safe = False
3131
include_package_data = True
3232
install_requires =
3333
pytest
34+
pytest-cov
3435
PyYAML
3536
requests
3637
cloudevents
@@ -44,6 +45,7 @@ dev =
4445
pre-commit
4546
pydocstyle
4647
pytest
48+
pytest-cov
4749
pytest_mock
4850
yamllint
4951
pylint

targets.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ package-install: ## install the package without dev dependencies
3131
test: ## run tests quickly with the default Python
3232
python -m pytest -m unit -vv
3333

34+
test-coverage: ## run tests quickly with the default Python
35+
python -m pytest --cov=cdevents tests
36+
3437
dist: clean ## builds source and wheel package
3538
python setup.py sdist
3639
python setup.py bdist_wheel

0 commit comments

Comments
 (0)