我正在为一个小的测试API项目使用tavern运行pytest。如果测试失败,会抛给我一堆冗长的错误以及我期望得到的响应(失败的原因)。怎样才能让pytest变得不那么冗长?
我尝试了pytest --tb=short,pytest -vv,pytest --tavern beta-new-traceback,没有一个像预期的那样工作,只是告诉我失败的原因。类似于:
E tavern.util.exceptions.TestFailError: Test 'Do something' failed:
- Status code was 200, expected 300
-------------------------------------------------------- Captured log call --------------------------------------------------------
base.py 41 ERROR Status code was 200, expected 300
==================================================== 1 failed in 0.38 seconds =====================================================也许酒馆处理错误或pytest的方式有问题?
发布于 2019-10-16 04:47:30
运行pytest -vv会使您的输出更加冗长。如果希望输出不那么冗长,可以尝试使用pytest -q或pytest --quiet。
发布于 2020-09-18 15:54:42
有时,使用更高的日志级别可能会减少最严重的输出混乱。例如,使用
pytest <my_test_folder> --log-cli-level=warning日志级别的不同选项(从最详细到最不详细)是:debug、info、warning、error和critical。
https://stackoverflow.com/questions/56072381
复制相似问题