Skip to content

Commit 4d86874

Browse files
committed
Enable branch coverage measurement in pytest
1 parent 3a386f4 commit 4d86874

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

poetry.lock

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ipython = "^7.18.1"
3535
mypy = "^0.782"
3636
pytest-cov = "^2.10.1"
3737
pytest-structlog = "^0.3"
38+
coverage = {extras = ["toml"], version = "^5.3"}
3839

3940
[tool.black]
4041
line-length = 120
@@ -51,6 +52,9 @@ exclude = '''
5152
)/
5253
'''
5354

55+
[tool.coverage.run]
56+
branch = true
57+
5458
[tool.pylint.general]
5559
extension-pkg-whitelist = [
5660
"pydantic"

tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def pytest(context, name=NAME, python_ver=PYTHON_VER):
123123
# Install python module
124124
docker = f"docker run -it -v {PWD}:/local {name}-{python_ver}:latest"
125125
context.run(
126-
f"{docker} /bin/bash -c 'poetry install && pytest --cov=diffsync --cov-report html --cov-report term -vv'",
126+
f"{docker} /bin/bash -c 'poetry install && pytest "
127+
"--cov=diffsync --cov-config pyproject.toml --cov-report html --cov-report term -vv'",
127128
pty=True,
128129
)
129130

0 commit comments

Comments
 (0)