【发布时间】:2018-09-19 03:43:41
【问题描述】:
我是使用 Pytest 进行测试的新手,我遇到了一个小问题但很烦人。
在命令行测试会话结果中,我看到我的测试通过了,但对于某些测试,显示的百分比不是 100%。
通过一些积极的日志记录,我能够确认我的测试按预期通过。
我的问题是:为收集的测试显示的百分比是什么意思?
例子:
platform win32 -- Python 3.7.0a4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: C:\api-check, inifile:
collected 5 items
test_Me.py ... [ 60%]
test_env.py .. [100%]
========================== 5 passed in 6.04 seconds ===========================
【问题讨论】:
-
收集的总测试数的百分比。例如收集了 5 个项目...
test_Me.py有 3 个测试 = 60%...不是超级复杂 -
@abigperson 这没有多大意义。
test_Me中的 60% 测试和test_env中的 100% 测试怎么可能?上次我检查时,百分比不是这样工作的。 -
也许百分比是累积的?尝试添加第三个测试文件,看看输出是什么样的。
-
我启动了一个 PR 来更新 pytest 文档,并提供以下答案(谢谢!):github.com/pytest-dev/pytest/pull/6686。请随时发表评论或投票。
标签: python testing pytest functional-testing