如何查看pytest运行期间创建的正常打印输出? [英] How can I see normal print output created during pytest run?

查看:721
本文介绍了如何查看pytest运行期间创建的正常打印输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,我只想在代码中插入一些打印语句,然后看看我在练习时会打印出什么内容.我通常的锻炼"方式是使用现有的pytest测试.但是当我运行这些命令时,我似乎看不到任何标准输出(至少从我的IDE PyCharm内部).

Sometimes I want to just insert some print statements in my code, and see what gets printed out when I exercise it. My usual way to "exercise" it is with existing pytest tests. But when I run these, I don't seem able to see any standard output (at least from within PyCharm, my IDE).

有没有一种简单的方法可以在pytest运行期间查看标准输出?

Is there a simple way to see standard output during a pytest run?

推荐答案

The -s switch disables per-test capturing.

这篇关于如何查看pytest运行期间创建的正常打印输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆