Skip to content

Commit a295471

Browse files
Compute coverage (#11)
1 parent 7e13d84 commit a295471

File tree

4 files changed

+78
-75
lines changed

4 files changed

+78
-75
lines changed

.github/workflows/ci.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,33 @@ jobs:
5353

5454
- name: Run tests
5555
run: uvx --with tox-uv tox -e ${{ matrix.python-version }}
56+
57+
- name: Upload coverage data
58+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
59+
with:
60+
include-hidden-files: true
61+
name: coverage-data-${{ matrix.os }}-py${{ matrix.python-version }}
62+
path: ".coverage.*"
63+
64+
coverage:
65+
name: Coverage
66+
runs-on: ubuntu-latest
67+
needs: test
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
71+
72+
- name: Download coverage data
73+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
74+
with:
75+
pattern: coverage-data-*
76+
merge-multiple: true
77+
78+
- name: Set up Python
79+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
80+
81+
- name: Install uv
82+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
83+
84+
- name: Combine coverage data and generate report
85+
run: uvx --with tox-uv tox -e coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ dist/
1010
.vscode
1111
.python-version
1212
.tox/
13+
coverage.xml

pyproject.toml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ dev = [
4545
"types-requests>=2.27.20",
4646
]
4747
tests = [
48+
"coverage>=7.2.7",
4849
"pytest>=7.1.2",
4950
"pytest-asyncio>=0.18.3",
50-
"pytest-cov>=3.0.0",
5151
"requests>=2.26.0",
5252
"responses>=0.20.0",
5353
]
@@ -75,13 +75,50 @@ env_list = [
7575
[tool.tox.env_run_base]
7676
description = "run unit tests"
7777
dependency_groups = [ "tests" ]
78-
commands = [ [ "pytest", { replace = "posargs", default = [ "tests" ], extend = true } ] ]
78+
commands = [ [ "coverage", "run", "-m", "pytest", { replace = "posargs", default = [ "tests" ], extend = true } ] ]
79+
80+
[tool.tox.env.coverage]
81+
description = "generate coverage report"
82+
depends = [
83+
"3.7",
84+
"3.8",
85+
"3.9",
86+
"3.10",
87+
"3.11",
88+
"3.12",
89+
"3.13",
90+
"3.14",
91+
]
92+
dependency_groups = [ "tests" ]
93+
commands = [
94+
[ "coverage", "combine" ],
95+
[ "coverage", "report" ],
96+
[ "coverage", "xml" ],
97+
]
7998

8099
[tool.pytest.ini_options]
81100
filterwarnings = [
82101
"error",
83102
]
84103

104+
[tool.coverage.paths]
105+
package = [
106+
"backoff/",
107+
"*/site-packages/backoff/",
108+
]
109+
110+
[tool.coverage.report]
111+
fail_under = 100
112+
show_missing = true
113+
114+
[tool.coverage.run]
115+
branch = true
116+
parallel = true
117+
relative_files = true
118+
source = [
119+
"backoff",
120+
]
121+
85122
[build-system]
86123
requires = ["hatchling"]
87124
build-backend = "hatchling.build"

uv.lock

Lines changed: 8 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)