如何抑制 py.test 内部弃用警告 [英] How to suppress py.test internal deprecation warnings
问题描述
有没有办法抑制 pytest 的内部弃用警告?
Is there a way to suppress the pytest's internal deprecation warnings?
上下文:我希望评估将测试套件从 nose
移植到 pytest
的难度.该套件相当大,并且大量使用基于 nose
风格的 yield
测试生成器.
Context: I'm looking to evaluate the difficulty of porting a test suite from nose
to pytest
. The suite is fairly large and heavily uses nose
-style yield
based test generators.
我想首先确保现有测试通过pytest,然后可能将测试生成器更改为参数化
.
I'd like to first make sure the existing tests pass with pytest, and then maybe change test generators to parameterized
.
刚刚用pytest 3.0.4运行$ pytest path-to-test-folder
完全被页面和页面所支配
Just running $ pytest path-to-test-folder
with pytest 3.0.4 is completely dominated by pages and pages of
WC1 ~repos/numpy/numpy/lib/tests/test_twodim_base.py yield tests are deprecated, and scheduled to be removed in pytest 4.0
有没有办法关闭这些警告?
Is there a way of turning these warnings off?
推荐答案
来自 pytest --help
:
--disable-pytest-warnings
disable warnings summary, overrides -r w flag
这篇关于如何抑制 py.test 内部弃用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!