Closed stefaneidelloth closed 1 year ago
New in Coverage 7.0 is the include_namespace_packages
setting which I think will do what you want: https://coverage.readthedocs.io/en/7.0.0/config.html#report-include-namespace-packages
Yes, that did the trick. Thanks a lot!
[tool.coverage.report]
include_namespace_packages = true
Originally posted by @ionelmc in https://github.com/pytest-dev/pytest-cov/issues/88#issuecomment-139555501
If I have a file src/utils/foo.py an run
pytest --cov=src
I would expext that foo.py is reported as uncovered. However, it is not.
If I run
pytest --cov=src/utils
the file is reported as uncovered.
=> How can I tell pytest-cov to look for uncovered files recursively? Is there some flag I can set in pyproject.toml or do I need to use some regular expression for some file path property?
(Adding empty init.py files would also help to identify uncovered files. However, adding init.py files only for determining coverage seems to be weird. Especially as the need for those files vanishes once the tests are written.)
I use pytest 7.2.0, pytest-cov 4.0.0 and python 3.10.5
My pyproject.toml file contains following settings: