Missing code-coverage within `pytest_sessionfinish`
See original GitHub issueSummary
Code present within project.specific.conftest::pytest_sessionfinish() is shown as “not covered”, although it is executed.
Comparing pytest-cov
with coverage
,
Code within pytest_sessionfinish
is presented as covered when python-coverage is used with the following command
coverage run --include conftest.py -m pytest test_dummy.py && coverage html -d cov_report
Link to test_dummy.py.
Expected vs actual result
Code executed within pytest_sessionfinish
should be presented as covered.
Reproducer
README files consists of the instructions to setup the virtual-environment and pytest framework.
Other files of interest within the referred repository:
- pyproject.toml: consists of pytest-cov related switches
Versions
Requirements file can be accessed here: https://github.com/dshah244/dummy_pytest/blob/master/req_dev.txt
Output of pip freeze
:
-e .
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.0.6
pytest==6.2.5
pytest-cov==3.0.0
pytest-html==3.1.1
pytest-metadata==1.11.0
toml==0.10.2
tomli==1.2.2
python --version
= pytest 6.2.5
pytest --version
= Python 3.10.0
Config
https://github.com/dshah244/dummy_pytest/blob/master/pyproject.toml
Code
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (1 by maintainers)
Top GitHub Comments
You might want to copy some of the tricks here: https://pytest-cov.readthedocs.io/en/latest/plugins.html
Thanks for the tip @ionelmc 👍