0
pytest capsys
fixture确实很有用,但它只要将它包含在夹具中就能立即捕获所有东西。我只想在测试中捕获特定行的输出。明确启用的capsys pytest夹具
它实际上提供了“禁用”背景:
def test_disabling_capturing(capsys):
print('this output is captured')
with capsys.disabled():
print('output not captured, going directly to sys.stdout')
print('this output is also captured')
但我想是这样的,该相反:
def test_disabling_capturing(capsys):
print('this output is not captured')
with capsys.enabled():
print('output is captured')
print('this output is also not captured')
是否有可能与capsys工装夹具不知何故?