pytest-cookies
pytest-cookies copied to clipboard
How to get coverage?
Hello,
I can't get the coverage properly evaluated. Would you know how to fix this? There are mainly two tests, one with the defaults and one with custom parameters.
Thank you,
tests/test_cookiecutter.py:
def test_defaults(cookies):
result = cookies.bake()
assert...
def test_customization(cookies):
result = cookies.bake(extra_context={...})
pyproject.toml:
[tool.poetry.dependencies]
python = "^3.10"
pytest-cookies = "^0.7.0"
[tool.poetry.group.test.dependencies]
pytest = "^7.4.2"
pytest-cov = "^4.1.0"
pytest-httpserver = "^1.0.8"
coverage = {extras = ["toml"], version = "^6.5.0"}
pytest-mock = "^3.11.1"
[tool.pytest.ini_options]
log_cli = true
minversion = "6.0"
addopts = """
--cov-report html:build/coverage-html
--cov-report xml:build/coverage.xml
--cov-report term
--cov=hooks
--cov-branch
"""
testpaths = ["tests"]
$ poetry run pytest
platform linux -- Python 3.10.10, pytest-7.4.4, pluggy-1.5.0
rootdir: ...
configfile: pyproject.toml
testpaths: tests
plugins: mock-3.14.0, cookies-0.7.0, cov-4.1.0, pytest_httpserver-1.0.10
collected 2 items
tests/test_cookiecutter.py::test_defaults PASSED [ 50%]
tests/test_cookiecutter.py::test_customization PASSED [100%]
.../.cache/pypoetry/virtualenvs/cookiecutter-sonar--COI_dO4-py3.10/lib/python3.10/site-packages/coverage/control.py:801: CoverageWarning: No data was collected. (no-data-collected)
self._warn("No data was collected.", slug="no-data-collected")
---------- coverage: platform linux, python 3.10.10-final-0 ----------
Name Stmts Miss Cover
-----------------------------------------------
hooks/post_gen_project.py 33 33 0%
hooks/pre_gen_project.py 0 0 100%
-----------------------------------------------
TOTAL 33 33 0%