Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在pytest looponfail模式下启用print语句?_Python_Pytest - Fatal编程技术网

Python 如何在pytest looponfail模式下启用print语句?

Python 如何在pytest looponfail模式下启用print语句?,python,pytest,Python,Pytest,我像这样执行py.test:py.test-s-f,-f是looponfail模式,-s是--capture=no模式 但是只有当测试失败时才允许使用print()语句。如果所有测试都成功,则所有代码中的所有print()都不起作用 即使在looponfail模式下,如何启用print()语句 Python 3.4 Py.试验2.7.2 您应该只更新到更新的pytest。看起来此问题已在pytest=2.9.0中修复。您只需更新到较新的pytest。看起来此问题已在pytest=2.9.0中修

我像这样执行
py.test
py.test-s-f
-f
looponfail
模式,
-s
--capture=no
模式

但是只有当测试失败时才允许使用
print()
语句。如果所有测试都成功,则所有代码中的所有
print()
都不起作用

即使在
looponfail
模式下,如何启用
print()
语句

  • Python 3.4
  • Py.试验2.7.2

您应该只更新到更新的
pytest
。看起来此问题已在
pytest=2.9.0
中修复。您只需更新到较新的
pytest
。看起来此问题已在
pytest=2.9.0
中修复