擅长:python、mysql、java
<p>{a1}将完成以下工作:</p>
<pre><code>@pytest.mark.skip(reason="no way of currently testing this")
def test_func_one():
# ...
</code></pre>
<p>(<code>reason</code>参数是可选的,但最好指定跳过测试的原因)</p>
<p>还有<a href="http://doc.pytest.org/en/latest/skipping.html#id1" rel="noreferrer">^{<cd3>}</a>允许在满足某些特定条件时禁用测试</p>
<hr/>
<p>这些装饰器可以应用于方法、函数或类</p>
<p>要<a href="http://doc.pytest.org/en/latest/skipping.html#skip-all-test-functions-of-a-class-or-module" rel="noreferrer">skip all tests in a module</a>,请定义一个全局<code>pytestmark</code>变量:</p>
<pre><code># test_module.py
pytestmark = pytest.mark.skipif(...)
</code></pre>