相关疑难解决方法(0)

如何阻止Python unittest打印测试文档字符串?

我注意到,当我的Python单元测试包含函数顶部的文档时,框架有时会在测试输出中打印它们.通常,测试输出每行包含一个测试:

<test name> ... ok 
Run Code Online (Sandbox Code Playgroud)

如果测试具有表单的文档字符串

"""
test that so and so happens
"""
Run Code Online (Sandbox Code Playgroud)

比一切都好.但是如果测试在一行上都有一个文档字符串:

"""test that so and so happens"""
Run Code Online (Sandbox Code Playgroud)

然后测试输出需要多行,并包含如下文档:

<test name>
test that so and so happens ... ok
Run Code Online (Sandbox Code Playgroud)

我无法找到这是记录在案的行为.有没有办法把它关掉?

python unit-testing

13
推荐指数
1
解决办法
3359
查看次数

标签 统计

python ×1

unit-testing ×1