我正在使用 tox 使用 tox -p(并行运行)在不同的环境上运行测试,但是在为所有测试生成覆盖率报告时遇到问题。
毒物.ini:
[tox]
envlist = env1,ev2,report
skipsdist=True
[base]
deps = pytest
[testenv:env1]
deps = custom-package-1
{[base]deps}
commands = pytest --cov-append tests/flows/test_1.py
[testenv:env2]
deps = custom-package-2
{[base]deps}
commands = pytest --cov-append tests/flows/test_2.py
[testenv:report]
deps = coverage[toml]
commands = coverage report
depends = env1,env2
parallel_show_output = true
pyproject.toml 覆盖部分:
[tool.coverage.report]
fail_under = 100
show_missing = true
exclude_lines = [
'pragma: no cover',
'\.\.\.',
'if TYPE_CHECKING:',
"if __name__ == '__main__':",
]
错误:
No source for code: '/Users/my_user/projects/my_proect/flows/__init__.py'.
有人可以告诉我提供的配置有什么问题吗?