Skip to content

Commit beffa10

Browse files
committed
Tests: Report code coverage
1 parent c060d98 commit beffa10

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,14 @@ jobs:
5656
- name: Run tests
5757
run: |
5858
make test
59+
60+
- name: Upload coverage to Codecov
61+
uses: codecov/codecov-action@v4
62+
env:
63+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
64+
with:
65+
files: ./coverage.xml
66+
flags: unittests
67+
env_vars: OS,PYTHON
68+
name: codecov-umbrella
69+
fail_ci_if_error: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
/.venv*
66
/var
77
/dist
8+
.coverage
9+
coverage.xml

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ profile = "black"
66
src_paths = ["grafana_wtf", "tests"]
77

88
[tool.pytest.ini_options]
9-
addopts = "-ra -q --verbosity=3 --doctest-modules"
9+
addopts = """
10+
-ra -q --verbosity=3 --doctest-modules
11+
--cov --cov-report=term-missing --cov-report=xml
12+
"""
1013
minversion = "2.0"
1114
log_level = "DEBUG"
1215
log_cli_level = "DEBUG"
@@ -15,3 +18,13 @@ testpaths = [
1518
"tests",
1619
]
1720
xfail_strict = true
21+
22+
[tool.coverage.run]
23+
branch = false
24+
source = ["grafana_wtf"]
25+
26+
[tool.coverage.report]
27+
fail_under = 0
28+
show_missing = true
29+
omit = [
30+
]

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
extras = {
3535
"test": [
3636
"pytest<9",
37+
"pytest-cov<6",
3738
"lovely-pytest-docker<1",
3839
"grafanalib==0.7.0",
3940
]

0 commit comments

Comments
 (0)