繁体   English   中英

如何使用 tox 配置覆盖率?

[英]How to configure coverage with tox?

我正在使用 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'.

有人可以告诉我提供的配置有什么问题吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM