summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'guide/pytest.html')
-rw-r--r--guide/pytest.html81
1 files changed, 14 insertions, 67 deletions
diff --git a/guide/pytest.html b/guide/pytest.html
index d562add..4da5870 100644
--- a/guide/pytest.html
+++ b/guide/pytest.html
@@ -7,7 +7,8 @@
<title>pytest recipes &#8212; Gentoo Python Guide documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
- <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
+ <link rel="stylesheet" type="text/css" href="_static/basic.css?v=c058f7c8" />
+ <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=27fed22d" />
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
@@ -369,58 +370,6 @@ plugins.</p>
</tbody>
</table>
</section>
-<section id="warnings">
-<h2>Warnings<a class="headerlink" href="#warnings" title="Link to this heading">¶</a></h2>
-<p>pytest captures all warnings from the test suite by default, and prints
-a summary of them at the end of the test suite run:</p>
-<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">===============================</span><span class="w"> </span>warnings<span class="w"> </span><span class="nv">summary</span><span class="w"> </span><span class="o">===============================</span>
-asgiref/sync.py:135:<span class="w"> </span><span class="m">1</span><span class="w"> </span>warning
-tests/test_local.py:<span class="w"> </span><span class="m">5</span><span class="w"> </span>warnings
-tests/test_sync.py:<span class="w"> </span><span class="m">12</span><span class="w"> </span>warnings
-tests/test_sync_contextvars.py:<span class="w"> </span><span class="m">1</span><span class="w"> </span>warning
-<span class="w"> </span>/tmp/asgiref/asgiref/sync.py:135:<span class="w"> </span>DeprecationWarning:<span class="w"> </span>There<span class="w"> </span>is<span class="w"> </span>no<span class="w"> </span>current<span class="w"> </span>event<span class="w"> </span>loop
-<span class="w"> </span>self.main_event_loop<span class="w"> </span><span class="o">=</span><span class="w"> </span>asyncio.get_event_loop<span class="o">()</span>
-<span class="o">[</span>...<span class="o">]</span>
-</pre></div>
-</div>
-<p>However, some projects go further and use <code class="docutils literal notranslate"><span class="pre">filterwarnings</span></code> option
-to make (some) warnings fatal:</p>
-<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">====================================</span><span class="w"> </span><span class="nv">ERRORS</span><span class="w"> </span><span class="o">====================================</span>
-_____________________<span class="w"> </span>ERROR<span class="w"> </span>collecting<span class="w"> </span>tests/test_sync.py<span class="w"> </span>______________________
-tests/test_sync.py:577:<span class="w"> </span><span class="k">in</span><span class="w"> </span>&lt;module&gt;
-<span class="w"> </span>class<span class="w"> </span>ASGITest<span class="o">(</span>TestCase<span class="o">)</span>:
-tests/test_sync.py:583:<span class="w"> </span><span class="k">in</span><span class="w"> </span>ASGITest
-<span class="w"> </span>async<span class="w"> </span>def<span class="w"> </span>test_wrapped_case_is_collected<span class="o">(</span>self<span class="o">)</span>:
-asgiref/sync.py:135:<span class="w"> </span><span class="k">in</span><span class="w"> </span>__init__
-<span class="w"> </span>self.main_event_loop<span class="w"> </span><span class="o">=</span><span class="w"> </span>asyncio.get_event_loop<span class="o">()</span>
-E<span class="w"> </span>DeprecationWarning:<span class="w"> </span>There<span class="w"> </span>is<span class="w"> </span>no<span class="w"> </span>current<span class="w"> </span>event<span class="w"> </span><span class="nv">loop</span>
-<span class="o">===========================</span><span class="w"> </span>short<span class="w"> </span><span class="nb">test</span><span class="w"> </span>summary<span class="w"> </span><span class="nv">info</span><span class="w"> </span><span class="o">============================</span>
-ERROR<span class="w"> </span>tests/test_sync.py<span class="w"> </span>-<span class="w"> </span>DeprecationWarning:<span class="w"> </span>There<span class="w"> </span>is<span class="w"> </span>no<span class="w"> </span>current<span class="w"> </span>event<span class="w"> </span>loop
-!!!!!!!!!!!!!!!!!!!!<span class="w"> </span>Interrupted:<span class="w"> </span><span class="m">1</span><span class="w"> </span>error<span class="w"> </span>during<span class="w"> </span>collection<span class="w"> </span>!!!!!!!!!!!!!!!!!!!!
-<span class="o">===============================</span><span class="w"> </span><span class="m">1</span><span class="w"> </span>error<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">0</span>.13s<span class="w"> </span><span class="o">===============================</span>
-</pre></div>
-</div>
-<p>Unfortunately, this frequently means that warnings coming from
-a dependency trigger test failures in other packages. Since making
-warnings fatal is relatively common in the Python world, it is
-recommended to:</p>
-<ol class="arabic simple">
-<li><p>Fix warnings in Python packages whenever possible, even if they
-are not fatal to the package itself.</p></li>
-<li><p>Do not enable new Python implementations if they trigger any new
-warnings in the package.</p></li>
-</ol>
-<p>If the warnings come from issues in the package’s test suite rather than
-the installed code, it is acceptable to make them non-fatal. This can
-be done either through removing the <code class="docutils literal notranslate"><span class="pre">filterwarnings</span></code> key from
-<code class="docutils literal notranslate"><span class="pre">setup.cfg</span></code>, or adding an ignore entry. For example, the following
-setting ignores <code class="docutils literal notranslate"><span class="pre">DeprecationWarning</span></code> in <code class="docutils literal notranslate"><span class="pre">test</span></code> directory:</p>
-<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">filterwarnings</span><span class="w"> </span><span class="o">=</span>
-<span class="w"> </span>error
-<span class="w"> </span>ignore::DeprecationWarning:test
-</pre></div>
-</div>
-</section>
</section>
@@ -439,7 +388,16 @@ setting ignores <code class="docutils literal notranslate"><span class="pre">Dep
-<h3>Navigation</h3>
+
+<search id="searchbox" style="display: none" role="search">
+ <div class="searchformwrapper">
+ <form class="search" action="search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Search"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script><h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="preface.html">Preface</a></li>
@@ -468,7 +426,6 @@ setting ignores <code class="docutils literal notranslate"><span class="pre">Dep
<li class="toctree-l2"><a class="reference internal" href="#importpathmismatcherror">ImportPathMismatchError</a></li>
<li class="toctree-l2"><a class="reference internal" href="#failures-due-to-missing-files-in-temporary-directories">Failures due to missing files in temporary directories</a></li>
<li class="toctree-l2"><a class="reference internal" href="#fixture-not-found">fixture ‘…’ not found</a></li>
-<li class="toctree-l2"><a class="reference internal" href="#warnings">Warnings</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="concept.html">Advanced concepts</a></li>
@@ -490,16 +447,6 @@ setting ignores <code class="docutils literal notranslate"><span class="pre">Dep
</ul></li>
</ul>
</div>
-<search id="searchbox" style="display: none" role="search">
- <h3 id="searchlabel">Quick search</h3>
- <div class="searchformwrapper">
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
- <input type="submit" value="Go" />
- </form>
- </div>
-</search>
-<script>document.getElementById('searchbox').style.display = "block"</script>
@@ -516,8 +463,8 @@ setting ignores <code class="docutils literal notranslate"><span class="pre">Dep
&#169;2020, Michał Górny, license: CC BY 4.0.
|
- Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.4.7</a>
- &amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
+ Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.0.2</a>
+ &amp; <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>
|
<a href="_sources/pytest.rst.txt"