Skip to content

Commit 7552e88

Browse files
author
benoit-cty
committed
coverage config
1 parent 939b350 commit 7552e88

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/test-package.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ on:
66
pull_request:
77
paths:
88
- "codecarbon/**"
9+
- "test/**"
10+
- "pyproject.toml"
11+
- "uv.lock"
12+
push:
13+
branches: [master]
14+
paths:
15+
- "codecarbon/**"
16+
- "test/**"
917
- "pyproject.toml"
1018
- "uv.lock"
1119

@@ -28,7 +36,7 @@ jobs:
2836
- name: Test package
2937
run: uv run --python ${{ matrix.python-version }} task test-coverage
3038
- name: Upload coverage to Codecov
31-
uses: codecov/codecov-action@v5
39+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
3240
with:
3341
token: ${{ secrets.CODECOV_TOKEN }}
3442

pyproject.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ mypy-check = "mypy -m codecarbon --ignore-missing-imports --no-strict-optional -
155155
lint = "black --check --diff . && ruff check . && mypy ."
156156
format = "black . && ruff check --fix --exit-non-zero-on-fix ."
157157
test-package = "CODECARBON_ALLOW_MULTIPLE_RUNS=True pytest --ignore=tests/test_viz_data.py -vv -m 'not integ_test' tests/"
158-
test-coverage = "CODECARBON_ALLOW_MULTIPLE_RUNS=True pytest --cov=codecarbon --cov-report=xml --ignore=tests/test_viz_data.py -vv -m 'not integ_test' tests/"
158+
test-coverage = "CODECARBON_ALLOW_MULTIPLE_RUNS=True pytest --cov --cov-report=xml --ignore=tests/test_viz_data.py -vv -m 'not integ_test' tests/"
159159
test-package-integ = "CODECARBON_ALLOW_MULTIPLE_RUNS=True python -m pytest -vv tests/"
160160
docs = "cd docs/edit && make docs"
161161
carbonboard = "python codecarbon/viz/carbonboard.py"
@@ -174,3 +174,11 @@ version_pattern = "MAJOR.MINOR.PATCH[_TAGNUM]"
174174

175175
[tool.pytest.ini_options]
176176
pythonpath = "."
177+
178+
[tool.coverage.run]
179+
source = [
180+
"codecarbon",
181+
]
182+
omit = [
183+
"codecarbon/viz/*",
184+
]

0 commit comments

Comments
 (0)