擅长:python、mysql、java
<p>关于这个问题有一篇很好的文章:
<a href="https://pythontesting.net/framework/pytest/pytest-logging-real-time/" rel="nofollow noreferrer">https://pythontesting.net/framework/pytest/pytest-logging-real-time/</a></p>
<ul>
<li>我将所有print语句转换为底层代码中的日志语句</li>
<li>到包含我添加的<code>test_transform()</code>函数的模块</li>
</ul>
<p>`</p>
<pre><code>import logging
logging.basicConfig(level=logging.DEBUG)
def test_transform()
...
</code></pre>