擅长:python、mysql、java
<p>您可以尝试使用pytest来运行unittests。如果这是可行的(许多基于unittest的测试套件都可以工作),那么您可以创建一个小模块,例如“mymod.py公司,定义pytest配置挂钩:</p>
<pre><code># content of mymod.py
def pytest_configure():
import logging
logging.getLogger().setLevel(logging.WARN)
</code></pre>
<p>如果你现在执行py.测试像这样:</p>
^{pr2}$
<p>然后将搜索“mylib”包中的测试,并在运行它们之前修改日志级别。“-p”选项指定要加载的插件,“pyargs”告诉pytest先尝试导入参数,而不是将它们当作目录或文件名(默认设置)。在</p>
<p>有关详细信息:<a href="http://pytest.org" rel="nofollow">http://pytest.org</a>和<a href="http://pytest.org/latest/unittest.html" rel="nofollow">http://pytest.org/latest/unittest.html</a></p>
<p>嗯,
霍尔格</p>