pytest
不捕获位于pytest_sessionfinish()
或其中调用的代码中的print()
语句(stdout
输出)。在测试、fixture等中获得相同或类似行为的最佳实践是什么。?在
# conftest.py
def pytest_sessionfinish(session, exitstatus):
print('This wont be captured (like in tests) but output independent of pytest exit status (exitstatus).')
if exitstatus == 0:
print('stdout shall be captured/suppressed in case of overall test PASS.')
else:
print('stdout shall be output in case of overall test FAIL and any other error.')
目前没有回答
相关问题 更多 >
编程相关推荐