title: How to use pytest to assert NO Warning is raised
body: <p>I want to ensure that <em>no warning at all</em> is raised in one assertion.</p>
  <p>Could not find any explicit answer in <a href="https://docs.pytest.org/en/3.2.1/warnings.html#assertwarnings" rel="nofollow noreferrer">pytest documentation about warnings</a>. (dead link, the 3.2.* doc is not available anymore).</p>
  <p>I've tried this, thinking maybe <code>None</code> would mean &quot;nothing&quot;:</p>
  <pre><code>def test_AttrStr_parse_warnings():
      &quot;&quot;&quot;Check _AttrStr.parse() raises proper warnings in proper cases.&quot;&quot;&quot;
      with pytest.warns(None):
          _AttrStr('').parse()
  </code></pre>
  <p>but this assertion is also always correct, for instance, the test does not fail, even if a warning is actually raised:</p>
  <pre><code>def test_AttrStr_parse_warnings():
      &quot;&quot;&quot;Check _AttrStr.parse() raises proper warnings in proper cases.&quot;&quot;&quot;
      with pytest.warns(None):
          _AttrStr('').parse()
          warnings.warn('any message')
  </code></pre>