/usr/share/doc/python-pytest/html/plugins.html is in python-pytest-doc 3.3.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installing and Using plugins — pytest documentation</title>
<link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.3',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="shortcut icon" href="_static/pytest1favi.ico"/>
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Writing plugins" href="writing_plugins.html" />
<link rel="prev" title="classic xunit-style setup" href="xunit_setup.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="writing_plugins.html" title="Writing plugins"
accesskey="N">next</a></li>
<li class="right" >
<a href="xunit_setup.html" title="classic xunit-style setup"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="contents.html">pytest-3.3</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="installing-and-using-plugins">
<span id="using-plugins"></span><span id="extplugins"></span><span id="external-plugins"></span><h1>Installing and Using plugins<a class="headerlink" href="#installing-and-using-plugins" title="Permalink to this headline">¶</a></h1>
<p>This section talks about installing and using third party plugins.
For writing your own plugins, please refer to <a class="reference internal" href="writing_plugins.html#writing-plugins"><span class="std std-ref">Writing plugins</span></a>.</p>
<p>Installing a third party plugin can be easily done with <code class="docutils literal"><span class="pre">pip</span></code>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">pytest</span><span class="o">-</span><span class="n">NAME</span>
<span class="n">pip</span> <span class="n">uninstall</span> <span class="n">pytest</span><span class="o">-</span><span class="n">NAME</span>
</pre></div>
</div>
<p>If a plugin is installed, <code class="docutils literal"><span class="pre">pytest</span></code> automatically finds and integrates it,
there is no need to activate it.</p>
<p>Here is a little annotated list for some popular plugins:</p>
<ul class="simple">
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-django">pytest-django</a>: write tests
for <a class="reference external" href="https://www.djangoproject.com/">django</a> apps, using pytest integration.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-twisted">pytest-twisted</a>: write tests
for <a class="reference external" href="http://twistedmatrix.com">twisted</a> apps, starting a reactor and
processing deferreds from test functions.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-cov">pytest-cov</a>:
coverage reporting, compatible with distributed testing</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-xdist">pytest-xdist</a>:
to distribute tests to CPUs and remote hosts, to run in boxed
mode which allows to survive segmentation faults, to run in
looponfailing mode, automatically re-running failing tests
on file changes.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-instafail">pytest-instafail</a>:
to report failures while the test run is happening.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-bdd">pytest-bdd</a> and
<a class="reference external" href="http://pypi.python.org/pypi/pytest-konira">pytest-konira</a>
to write tests using behaviour-driven testing.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-timeout">pytest-timeout</a>:
to timeout tests based on function marks or global definitions.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-pep8">pytest-pep8</a>:
a <code class="docutils literal"><span class="pre">--pep8</span></code> option to enable PEP8 compliance checking.</li>
<li><a class="reference external" href="https://pypi.python.org/pypi/pytest-flakes">pytest-flakes</a>:
check source code with pyflakes.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/oejskit">oejskit</a>:
a plugin to run javascript unittests in live browsers.</li>
</ul>
<p>To see a complete list of all plugins with their latest testing
status against different pytest and Python versions, please visit
<a class="reference external" href="http://plugincompat.herokuapp.com/">plugincompat</a>.</p>
<p>You may also discover more plugins through a <a class="reference external" href="http://pypi.python.org/pypi?%3Aaction=search&term=pytest-&submit=search">pytest- pypi.python.org search</a>.</p>
<div class="section" id="requiring-loading-plugins-in-a-test-module-or-conftest-file">
<h2>Requiring/Loading plugins in a test module or conftest file<a class="headerlink" href="#requiring-loading-plugins-in-a-test-module-or-conftest-file" title="Permalink to this headline">¶</a></h2>
<p>You can require plugins in a test module or a conftest file like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pytest_plugins</span> <span class="o">=</span> <span class="s2">"myapp.testsupport.myplugin"</span><span class="p">,</span>
</pre></div>
</div>
<p>When the test module or conftest plugin is loaded the specified plugins
will be loaded as well.</p>
<blockquote>
<div>pytest_plugins = "myapp.testsupport.myplugin"</div></blockquote>
<p>which will import the specified module as a <code class="docutils literal"><span class="pre">pytest</span></code> plugin.</p>
</div>
<div class="section" id="finding-out-which-plugins-are-active">
<span id="findpluginname"></span><h2>Finding out which plugins are active<a class="headerlink" href="#finding-out-which-plugins-are-active" title="Permalink to this headline">¶</a></h2>
<p>If you want to find out which plugins are active in your
environment you can type:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pytest</span> <span class="o">--</span><span class="n">trace</span><span class="o">-</span><span class="n">config</span>
</pre></div>
</div>
<p>and will get an extended test header which shows activated plugins
and their names. It will also print local plugins aka
<a class="reference internal" href="writing_plugins.html#conftest-py-plugins"><span class="std std-ref">conftest.py</span></a> files when they are loaded.</p>
</div>
<div class="section" id="deactivating-unregistering-a-plugin-by-name">
<span id="cmdunregister"></span><h2>Deactivating / unregistering a plugin by name<a class="headerlink" href="#deactivating-unregistering-a-plugin-by-name" title="Permalink to this headline">¶</a></h2>
<p>You can prevent plugins from loading or unregister them:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pytest</span> <span class="o">-</span><span class="n">p</span> <span class="n">no</span><span class="p">:</span><span class="n">NAME</span>
</pre></div>
</div>
<p>This means that any subsequent try to activate/load the named
plugin will not work.</p>
<p>If you want to unconditionally disable a plugin for a project, you can add
this option to your <code class="docutils literal"><span class="pre">pytest.ini</span></code> file:</p>
<div class="highlight-ini"><div class="highlight"><pre><span></span><span class="k">[pytest]</span>
<span class="na">addopts</span> <span class="o">=</span> <span class="s">-p no:NAME</span>
</pre></div>
</div>
<p>Alternatively to disable it only in certain environments (for example in a
CI server), you can set <code class="docutils literal"><span class="pre">PYTEST_ADDOPTS</span></code> environment variable to
<code class="docutils literal"><span class="pre">-p</span> <span class="pre">no:name</span></code>.</p>
<p>See <a class="reference internal" href="#findpluginname"><span class="std std-ref">Finding out which plugins are active</span></a> for how to obtain the name of a plugin.</p>
</div>
<div class="section" id="pytest-default-plugin-reference">
<span id="builtin-plugins"></span><h2>Pytest default plugin reference<a class="headerlink" href="#pytest-default-plugin-reference" title="Permalink to this headline">¶</a></h2>
<p>You can find the source code for the following plugins
in the <a class="reference external" href="https://github.com/pytest-dev/pytest">pytest repository</a>.</p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.assertion</span></code></td>
<td>support for presenting detailed information in failing assertions.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.cacheprovider</span></code></td>
<td>merged implementation of the cache provider</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.capture</span></code></td>
<td>per-test stdout/stderr capturing mechanism.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.config</span></code></td>
<td>command line options, ini-file and conftest.py processing.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.doctest</span></code></td>
<td>discover and run doctests in modules and test files.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.helpconfig</span></code></td>
<td>version info, help messages, tracing configuration.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.junitxml</span></code></td>
<td>report test results in JUnit-XML format,</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.mark</span></code></td>
<td>generic mechanism for marking and selecting python functions.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.monkeypatch</span></code></td>
<td>monkeypatching and mocking functionality.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.nose</span></code></td>
<td>run test suites written for nose.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.pastebin</span></code></td>
<td>submit failure or test session information to a pastebin service.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.debugging</span></code></td>
<td>interactive debugging with PDB, the Python Debugger.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.pytester</span></code></td>
<td>(disabled by default) support for testing pytest and pytest plugins.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.python</span></code></td>
<td>Python test discovery, setup and run of test functions.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.recwarn</span></code></td>
<td>recording warnings during test function execution.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.resultlog</span></code></td>
<td>log machine-parseable test session result information in a plain</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.runner</span></code></td>
<td>basic collect and runtest protocol implementations</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.main</span></code></td>
<td>core implementation of testing process: init, session, runtest loop.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.skipping</span></code></td>
<td>support for skip/xfail functions and markers.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.terminal</span></code></td>
<td>terminal reporting of the full testing process.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.tmpdir</span></code></td>
<td>support for providing temporary directories to test functions.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">_pytest.unittest</span></code></td>
<td>discovery and running of std-library "unittest" style tests.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="contents.html">
<img class="logo" src="_static/pytest1.png" alt="Logo"/>
</a></p><h3><a href="contents.html">Table Of Contents</a></h3>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="contents.html">Contents</a></li>
<li><a href="getting-started.html">Install</a></li>
<li><a href="example/index.html">Examples</a></li>
<li><a href="customize.html">Customize</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="talks.html">Talks/Posts</a></li>
<li><a href="changelog.html">Changelog</a></li>
<li><a href="backwards-compatibility.html">Backwards Compatibility</a></li>
<li><a href="license.html">License</a></li>
</ul>
<hr>
<ul>
<li><a class="reference internal" href="#">Installing and Using plugins</a><ul>
<li><a class="reference internal" href="#requiring-loading-plugins-in-a-test-module-or-conftest-file">Requiring/Loading plugins in a test module or conftest file</a></li>
<li><a class="reference internal" href="#finding-out-which-plugins-are-active">Finding out which plugins are active</a></li>
<li><a class="reference internal" href="#deactivating-unregistering-a-plugin-by-name">Deactivating / unregistering a plugin by name</a></li>
<li><a class="reference internal" href="#pytest-default-plugin-reference">Pytest default plugin reference</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
<li><a href="contents.html">Documentation overview</a><ul>
<li>Previous: <a href="xunit_setup.html" title="previous chapter">classic xunit-style setup</a></li>
<li>Next: <a href="writing_plugins.html" title="next chapter">Writing plugins</a></li>
</ul></li>
</ul><h3>Useful Links</h3>
<ul>
<li><a href="index.html">The pytest Website</a></li>
<li><a href="contributing.html">Contribution Guide</a></li>
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>
<li><a href="https://github.com/pytest-dev/pytest/">pytest @ GitHub</a></li>
<li><a href="http://plugincompat.herokuapp.com/">3rd party plugins</a></li>
<li><a href="https://github.com/pytest-dev/pytest/issues">Issue Tracker</a></li>
<li><a href="https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf">PDF Documentation</a>
</ul>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2018, holger krekel and pytest-dev team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>
|