Pytest cov 没有从 pyproject.toml 文件中读取其设置。我正在使用 nox,所以我运行测试:
python3 -m nox
即使没有nox,我似乎也有同样的问题。
事实上,在运行之后poetry install
:
poetry run pytest --cov=src
通过测试poetry run pytest --cov
没有通过测试
特别是,当测试失败时,我有以下输出(输出被削减到最重要的东西):
WARNING: Failed to generate report: No data to report.
/Users/matteo/Library/Caches/pypoetry/virtualenvs/project-Nz69kfmJ-py3.7/lib/python3.7/site-packages/pytest_cov/plugin.py:271: PytestWarning: Failed to generate report: No data to report.
self.cov_controller.finish()
---------- coverage: platform darwin, python 3.7.7-final-0 -----------
FAIL Required test coverage of 100.0% not reached. Total coverage: 0.00%
此处有可重现错误的代码。要运行它,您需要安装诗歌并安装 nox。