Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > 85556a06d0b40546e6bb4676359ced2e > files > 202

python-pytest-2.2.4-1mdv2010.1.noarch.rpm



<!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>Working with plugins and conftest files</title>
    <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '2.2.4',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </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="top" title="None" href="index.html" />
    <link rel="next" title="Talks and Tutorials" href="talks.html" />
    <link rel="prev" title="Doctest integration for modules and test files" href="doctest.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a></li>
        <li class="right" >
          <a href="talks.html" title="Talks and Tutorials"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="doctest.html" title="Doctest integration for modules and test files"
             accesskey="P">previous</a> |</li>
        <li><a href="contents.html">pytest-2.2.4</a> &raquo;</li>
 
<g:plusone></g:plusone>

      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Search" />
      <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>

<h3>quicklinks</h3>
<div style="text-align: left; font-size: 100%; vertical-align: middle;">
<table>
<tr>
<td>
        <a href="index.html">home</a>
</td><td>
        <a href="contents.html">TOC/contents</a>
</td></tr><tr><td>
        <a href="getting-started.html">install</a>
</td><td>
        <a href="changelog.html">changelog</a>
</td></tr><tr><td>
        <a href="example/index.html">examples</a>
</td><td>
        <a href="customize.html">customize</a>
</td></tr><tr><td>
        <a href="https://bitbucket.org/hpk42/pytest/issues?status=new&status=open">issues[bb]</a>
</td><td>
        <a href="contact.html">contact</a>
</td></tr></table>
</div>

  <h3><a href="contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Working with plugins and conftest files</a><ul>
<li><a class="reference internal" href="#conftest-py-local-per-directory-plugins">conftest.py: local per-directory plugins</a></li>
<li><a class="reference internal" href="#installing-external-plugins-searching">Installing External Plugins / Searching</a></li>
<li><a class="reference internal" href="#writing-a-plugin-by-looking-at-examples">Writing a plugin by looking at examples</a></li>
<li><a class="reference internal" href="#making-your-plugin-installable-by-others">Making your plugin installable by others</a></li>
<li><a class="reference internal" href="#plugin-discovery-order-at-tool-startup">Plugin discovery order at tool startup</a></li>
<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="#accessing-another-plugin-by-name">Accessing another plugin by name</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>
</ul>
</li>
<li><a class="reference internal" href="#py-test-default-plugin-reference">py.test default plugin reference</a></li>
<li><a class="reference internal" href="#py-test-hook-reference">py.test hook reference</a><ul>
<li><a class="reference internal" href="#hook-specification-and-validation">Hook specification and validation</a></li>
<li><a class="reference internal" href="#initialization-command-line-and-configuration-hooks">Initialization, command line and configuration hooks</a></li>
<li><a class="reference internal" href="#generic-runtest-hooks">Generic &#8220;runtest&#8221; hooks</a></li>
<li><a class="reference internal" href="#collection-hooks">Collection hooks</a></li>
<li><a class="reference internal" href="#reporting-hooks">Reporting hooks</a></li>
</ul>
</li>
<li><a class="reference internal" href="#reference-of-important-objects-involved-in-hooks">Reference of important objects involved in hooks</a></li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="doctest.html"
                        title="previous chapter">Doctest integration for modules and test files</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="talks.html"
                        title="next chapter">Talks and Tutorials</a></p>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="working-with-plugins-and-conftest-files">
<span id="plugins"></span><h1>Working with plugins and conftest files<a class="headerlink" href="#working-with-plugins-and-conftest-files" title="Permalink to this headline">¶</a></h1>
<p>py.test implements all aspects of configuration, collection, running and reporting by calling <a class="reference internal" href="#well-specified-hooks">well specified hooks</a>.  Virtually any Python module can be registered as a plugin.  It can implement any number of hook functions (usually two or three) which all have a <tt class="docutils literal"><span class="pre">pytest_</span></tt> prefix, making hook functions easy to distinguish and find.  There are three basic locations types:</p>
<ul class="simple">
<li><a class="reference internal" href="#builtin-plugins">builtin plugins</a>: loaded from py.test&#8217;s own <tt class="docutils literal"><span class="pre">pytest/plugin</span></tt> directory.</li>
<li><a class="reference internal" href="#external-plugins">external plugins</a>: modules discovered through <a class="reference internal" href="#setuptools-entry-points">setuptools entry points</a></li>
<li><a class="reference internal" href="#conftest-py-plugins">conftest.py plugins</a>: modules auto-discovered in test directories</li>
</ul>
<div class="section" id="conftest-py-local-per-directory-plugins">
<span id="conftest"></span><span id="localplugin"></span><span id="conftest-py"></span><span id="conftest-py-plugins"></span><h2>conftest.py: local per-directory plugins<a class="headerlink" href="#conftest-py-local-per-directory-plugins" title="Permalink to this headline">¶</a></h2>
<p>local <tt class="docutils literal"><span class="pre">conftest.py</span></tt> plugins contain directory-specific hook
implementations.  Session and test running activities will
invoke all hooks defined in <tt class="docutils literal"><span class="pre">conftest.py</span></tt> files closer to the
root of the filesystem.  Example: Assume the following layout
and content of files:</p>
<div class="highlight-python"><pre>a/conftest.py:
    def pytest_runtest_setup(item):
        # called for running each test in 'a' directory
        print ("setting up", item)

a/test_in_subdir.py:
    def test_sub():
        pass

test_flat.py:
    def test_flat():
        pass</pre>
</div>
<p>Here is how you might run it:</p>
<div class="highlight-python"><pre>py.test test_flat.py   # will not show "setting up"
py.test a/test_sub.py  # will show "setting up"</pre>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you have <tt class="docutils literal"><span class="pre">conftest.py</span></tt> files which do not reside in a
python package directory (i.e. one containing an <tt class="docutils literal"><span class="pre">__init__.py</span></tt>) then
&#8220;import conftest&#8221; can be ambiguous because there might be other
<tt class="docutils literal"><span class="pre">conftest.py</span></tt> files as well on your PYTHONPATH or <tt class="docutils literal"><span class="pre">sys.path</span></tt>.
It is thus good practise for projects to either put <tt class="docutils literal"><span class="pre">conftest.py</span></tt>
under a package scope or to never import anything from a
conftest.py file.</p>
</div>
</div>
<div class="section" id="installing-external-plugins-searching">
<span id="extplugins"></span><span id="external-plugins"></span><h2>Installing External Plugins / Searching<a class="headerlink" href="#installing-external-plugins-searching" title="Permalink to this headline">¶</a></h2>
<p>Installing a plugin happens through any usual Python installation
tool, for example:</p>
<div class="highlight-python"><pre>pip install pytest-NAME
pip uninstall pytest-NAME</pre>
</div>
<p>If a plugin is installed,  py.test automatically finds and integrates it,
there is no need to activate it.  Here is a list of known plugins:</p>
<ul class="simple">
<li><a class="reference external" href="http://pypi.python.org/pypi/pytest-capturelog">pytest-capturelog</a>:
to capture and assert about messages from the logging module</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, looponfailing mode,
see also <a class="reference internal" href="xdist.html#xdist"><em>xdist: pytest distributed testing plugin</em></a></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-pep8">pytest-pep8</a>:
a <tt class="docutils literal"><span class="pre">--pep8</span></tt> option to enable PEP8 compliance checking.</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/oejskit">oejskit</a>:
a plugin to run javascript unittests in life browsers
(<strong>version 0.8.9 not compatible with pytest-2.0</strong>)</li>
</ul>
<p>You may discover more plugins through a <a class="reference external" href="http://pypi.python.org/pypi?%3Aaction=search&amp;term=pytest-&amp;submit=search">pytest- pypi.python.org search</a>.</p>
</div>
<div class="section" id="writing-a-plugin-by-looking-at-examples">
<h2>Writing a plugin by looking at examples<a class="headerlink" href="#writing-a-plugin-by-looking-at-examples" title="Permalink to this headline">¶</a></h2>
<p>If you want to write a plugin, there are many real-life examples
you can copy from:</p>
<ul class="simple">
<li>a custom collection example plugin: <a class="reference internal" href="example/nonpython.html#yaml-plugin"><em>A basic example for specifying tests in Yaml files</em></a></li>
<li>around 20 <a class="reference internal" href="#builtin-plugins">builtin plugins</a> which comprise py.test&#8217;s own functionality</li>
<li>around 10 <a class="reference internal" href="#external-plugins">external plugins</a> providing additional features</li>
</ul>
<p>All of these plugins implement the documented <a class="reference internal" href="#well-specified-hooks">well specified hooks</a>
to extend and add functionality.</p>
</div>
<div class="section" id="making-your-plugin-installable-by-others">
<span id="setuptools-entry-points"></span><h2>Making your plugin installable by others<a class="headerlink" href="#making-your-plugin-installable-by-others" title="Permalink to this headline">¶</a></h2>
<p>If you want to make your plugin externally available, you
may define a so-called entry point for your distribution so
that <tt class="docutils literal"><span class="pre">py.test</span></tt> finds your plugin module.  Entry points are
a feature that is provided by <a class="reference external" href="http://pypi.python.org/pypi/setuptools">setuptools</a> or <a class="reference external" href="http://pypi.python.org/pypi/distribute">Distribute</a>.
py.test looks up the <tt class="docutils literal"><span class="pre">pytest11</span></tt> entrypoint to discover its
plugins and you can thus make your plugin available by definig
it in your setuptools/distribute-based setup-invocation:</p>
<div class="highlight-python"><pre># sample ./setup.py file
from setuptools import setup

setup(
    name="myproject",
    packages = ['myproject']

    # the following makes a plugin available to py.test
    entry_points = {
        'pytest11': [
            'name_of_plugin = myproject.pluginmodule',
        ]
    },
)</pre>
</div>
<p>If a package is installed this way, py.test will load
<tt class="docutils literal"><span class="pre">myproject.pluginmodule</span></tt> as a plugin which can define
<a class="reference internal" href="#well-specified-hooks">well specified hooks</a>.</p>
</div>
<div class="section" id="plugin-discovery-order-at-tool-startup">
<h2>Plugin discovery order at tool startup<a class="headerlink" href="#plugin-discovery-order-at-tool-startup" title="Permalink to this headline">¶</a></h2>
<p>py.test loads plugin modules at tool startup in the following way:</p>
<ul class="simple">
<li>by loading all builtin plugins</li>
<li>by loading all plugins registered through <a class="reference internal" href="#setuptools-entry-points">setuptools entry points</a>.</li>
<li>by pre-scanning the command line for the <tt class="docutils literal"><span class="pre">-p</span> <span class="pre">name</span></tt> option
and loading the specified plugin before actual command line parsing.</li>
<li>by loading all <tt class="file docutils literal"><span class="pre">conftest.py</span></tt> files as inferred by the command line
invocation (test files and all of its <em>parent</em> directories).
Note that <tt class="docutils literal"><span class="pre">conftest.py</span></tt> files from <em>sub</em> directories are by default
not loaded at tool startup.</li>
<li>by recursively loading all plugins specified by the
<tt class="docutils literal"><span class="pre">pytest_plugins</span></tt> variable in <tt class="docutils literal"><span class="pre">conftest.py</span></tt> files</li>
</ul>
</div>
<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-python"><div class="highlight"><pre><span class="n">pytest_plugins</span> <span class="o">=</span> <span class="s">&quot;name1&quot;</span><span class="p">,</span> <span class="s">&quot;name2&quot;</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.  You can also use dotted path like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">pytest_plugins</span> <span class="o">=</span> <span class="s">&quot;myapp.testsupport.myplugin&quot;</span>
</pre></div>
</div>
<p>which will import the specified module as a py.test plugin.</p>
</div>
<div class="section" id="accessing-another-plugin-by-name">
<h2>Accessing another plugin by name<a class="headerlink" href="#accessing-another-plugin-by-name" title="Permalink to this headline">¶</a></h2>
<p>If a plugin wants to collaborate with code from
another plugin it can obtain a reference through
the plugin manager like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">plugin</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">pluginmanager</span><span class="o">.</span><span class="n">getplugin</span><span class="p">(</span><span class="s">&quot;name_of_plugin&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>If you want to look at the names of existing plugins, use
the <tt class="docutils literal"><span class="pre">--traceconfig</span></tt> option.</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-python"><div class="highlight"><pre><span class="n">py</span><span class="o">.</span><span class="n">test</span> <span class="o">--</span><span class="n">traceconfig</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="#conftest"><em>conftest.py</em></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-python"><pre>py.test -p no:NAME</pre>
</div>
<p>This means that any subsequent try to activate/load the named
plugin will it already existing.  See <a class="reference internal" href="#findpluginname"><em>Finding out which plugins are active</em></a> for
how to obtain the name of a plugin.</p>
</div>
</div>
<div class="section" id="py-test-default-plugin-reference">
<span id="builtin-plugins"></span><h1>py.test default plugin reference<a class="headerlink" href="#py-test-default-plugin-reference" title="Permalink to this headline">¶</a></h1>
<p>You can find the source code for the following plugins
in the <a class="reference external" href="http://bitbucket.org/hpk42/pytest/">pytest repository</a>.</p>
<table border="1" class="docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.assertion</span></tt></td>
<td>support for presenting detailed information in failing assertions.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.capture</span></tt></td>
<td>per-test stdout/stderr capturing mechanisms, <tt class="docutils literal"><span class="pre">capsys</span></tt> and <tt class="docutils literal"><span class="pre">capfd</span></tt> function arguments.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.config</span></tt></td>
<td>command line options, ini-file and conftest.py processing.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.doctest</span></tt></td>
<td>discover and run doctests in modules and test files.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.genscript</span></tt></td>
<td>generate a single-file self-contained version of py.test</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.helpconfig</span></tt></td>
<td>version info, help messages, tracing configuration.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.junitxml</span></tt></td>
<td>report test results in JUnit-XML format, for use with Hudson and build integration servers.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.mark</span></tt></td>
<td>generic mechanism for marking and selecting python functions.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.monkeypatch</span></tt></td>
<td>monkeypatching and mocking functionality.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.nose</span></tt></td>
<td>run test suites written for nose.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.pastebin</span></tt></td>
<td>submit failure or test session information to a pastebin service.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.pdb</span></tt></td>
<td>interactive debugging with PDB, the Python Debugger.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.pytester</span></tt></td>
<td>(disabled by default) support for testing py.test and py.test plugins.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.python</span></tt></td>
<td>Python test discovery, setup and run of test functions.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.recwarn</span></tt></td>
<td>recording warnings during test function execution.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.resultlog</span></tt></td>
<td>(disabled by default) create result information in a plain text file.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.runner</span></tt></td>
<td>basic collect and runtest protocol implementations</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.main</span></tt></td>
<td>core implementation of testing process: init, session, runtest loop.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.skipping</span></tt></td>
<td>support for skip/xfail functions and markers.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.terminal</span></tt></td>
<td>terminal reporting of the full testing process.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.tmpdir</span></tt></td>
<td>support for providing temporary directories to test functions.</td>
</tr>
<tr><td><tt class="xref py py-obj docutils literal"><span class="pre">_pytest.unittest</span></tt></td>
<td>discovery and running of std-library &#8220;unittest&#8221; style tests.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="py-test-hook-reference">
<span id="well-specified-hooks"></span><h1>py.test hook reference<a class="headerlink" href="#py-test-hook-reference" title="Permalink to this headline">¶</a></h1>
<div class="section" id="hook-specification-and-validation">
<h2>Hook specification and validation<a class="headerlink" href="#hook-specification-and-validation" title="Permalink to this headline">¶</a></h2>
<p>py.test calls hook functions to implement initialization, running,
test execution and reporting.  When py.test loads a plugin it validates
that each hook function conforms to its respective hook specification.
Each hook function name and its argument names need to match a hook
specification.  However, a hook function may accept <em>fewer</em> parameters
by simply not specifying them.  If you mistype argument names or the
hook name itself you get an error showing the available arguments.</p>
</div>
<div class="section" id="initialization-command-line-and-configuration-hooks">
<h2>Initialization, command line and configuration hooks<a class="headerlink" href="#initialization-command-line-and-configuration-hooks" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="_pytest.hookspec.pytest_cmdline_preparse">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_cmdline_preparse</tt><big>(</big><em>config</em>, <em>args</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_cmdline_preparse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_cmdline_preparse" title="Permalink to this definition">¶</a></dt>
<dd><p>modify command line arguments before option parsing.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_cmdline_parse">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_cmdline_parse</tt><big>(</big><em>pluginmanager</em>, <em>args</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_cmdline_parse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_cmdline_parse" title="Permalink to this definition">¶</a></dt>
<dd><p>return initialized config object, parsing the specified args.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_namespace">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_namespace</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_namespace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_namespace" title="Permalink to this definition">¶</a></dt>
<dd><p>return dict of name-&gt;object to be made globally available in
the py.test/pytest namespace.  This hook is called before command
line options are parsed.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_addoption">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_addoption</tt><big>(</big><em>parser</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_addoption"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_addoption" title="Permalink to this definition">¶</a></dt>
<dd><p>add optparse-style options and ini-style config values via calls
to <tt class="docutils literal"><span class="pre">parser.addoption</span></tt> and <tt class="docutils literal"><span class="pre">parser.addini(...)</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_cmdline_main">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_cmdline_main</tt><big>(</big><em>config</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_cmdline_main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_cmdline_main" title="Permalink to this definition">¶</a></dt>
<dd><p>called for performing the main command line action. The default
implementation will invoke the configure hooks and runtest_mainloop.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_configure">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_configure</tt><big>(</big><em>config</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_configure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_configure" title="Permalink to this definition">¶</a></dt>
<dd><p>called after command line options have been parsed.
and all plugins and initial conftest files been loaded.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_unconfigure">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_unconfigure</tt><big>(</big><em>config</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_unconfigure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_unconfigure" title="Permalink to this definition">¶</a></dt>
<dd><p>called before test process is exited.</p>
</dd></dl>

</div>
<div class="section" id="generic-runtest-hooks">
<h2>Generic &#8220;runtest&#8221; hooks<a class="headerlink" href="#generic-runtest-hooks" title="Permalink to this headline">¶</a></h2>
<p>All all runtest related hooks receive a <tt class="xref py py-class docutils literal"><span class="pre">pytest.Item</span></tt> object.</p>
<dl class="function">
<dt id="_pytest.hookspec.pytest_runtest_protocol">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_runtest_protocol</tt><big>(</big><em>item</em>, <em>nextitem</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_runtest_protocol"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_runtest_protocol" title="Permalink to this definition">¶</a></dt>
<dd><p>implements the runtest_setup/call/teardown protocol for
the given test item, including capturing exceptions and calling
reporting hooks.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>item</strong> &#8211; test item for which the runtest protocol is performed.</li>
<li><strong>nexitem</strong> &#8211; the scheduled-to-be-next test item (or None if this
is the end my friend).  This argument is passed on to
<a class="reference internal" href="#_pytest.hookspec.pytest_runtest_teardown" title="_pytest.hookspec.pytest_runtest_teardown"><tt class="xref py py-func docutils literal"><span class="pre">pytest_runtest_teardown()</span></tt></a>.</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Return boolean:</th><td class="field-body"><p class="first last">True if no further hook implementations should be invoked.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_runtest_setup">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_runtest_setup</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_runtest_setup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_runtest_setup" title="Permalink to this definition">¶</a></dt>
<dd><p>called before <tt class="docutils literal"><span class="pre">pytest_runtest_call(item)</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_runtest_call">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_runtest_call</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_runtest_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_runtest_call" title="Permalink to this definition">¶</a></dt>
<dd><p>called to execute the test <tt class="docutils literal"><span class="pre">item</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_runtest_teardown">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_runtest_teardown</tt><big>(</big><em>item</em>, <em>nextitem</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_runtest_teardown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_runtest_teardown" title="Permalink to this definition">¶</a></dt>
<dd><p>called after <tt class="docutils literal"><span class="pre">pytest_runtest_call</span></tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nexitem</strong> &#8211; the scheduled-to-be-next test item (None if no further
test item is scheduled).  This argument can be used to
perform exact teardowns, i.e. calling just enough finalizers
so that nextitem only needs to call setup-functions.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_runtest_makereport">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_runtest_makereport</tt><big>(</big><em>item</em>, <em>call</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_runtest_makereport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_runtest_makereport" title="Permalink to this definition">¶</a></dt>
<dd><p>return a <a class="reference internal" href="#_pytest.runner.TestReport" title="_pytest.runner.TestReport"><tt class="xref py py-class docutils literal"><span class="pre">_pytest.runner.TestReport</span></tt></a> object
for the given <tt class="xref py py-class docutils literal"><span class="pre">pytest.Item</span></tt> and
<a class="reference internal" href="#_pytest.runner.CallInfo" title="_pytest.runner.CallInfo"><tt class="xref py py-class docutils literal"><span class="pre">_pytest.runner.CallInfo</span></tt></a>.</p>
</dd></dl>

<p>For deeper understanding you may look at the default implementation of
these hooks in <tt class="xref py py-mod docutils literal"><span class="pre">_pytest.runner</span></tt> and maybe also
in <tt class="xref py py-mod docutils literal"><span class="pre">_pytest.pdb</span></tt> which interacts with <tt class="xref py py-mod docutils literal"><span class="pre">_pytest.capture</span></tt>
and its input/output capturing in order to immediately drop
into interactive debugging when a test failure occurs.</p>
<p>The <tt class="xref py py-mod docutils literal"><span class="pre">_pytest.terminal</span></tt> reported specifically uses
the reporting hook to print information about a test run.</p>
</div>
<div class="section" id="collection-hooks">
<h2>Collection hooks<a class="headerlink" href="#collection-hooks" title="Permalink to this headline">¶</a></h2>
<p>py.test calls the following hooks for collecting files and directories:</p>
<dl class="function">
<dt id="_pytest.hookspec.pytest_ignore_collect">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_ignore_collect</tt><big>(</big><em>path</em>, <em>config</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_ignore_collect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_ignore_collect" title="Permalink to this definition">¶</a></dt>
<dd><p>return True to prevent considering this path for collection.
This hook is consulted for all files and directories prior to calling
more specific hooks.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_collect_directory">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_collect_directory</tt><big>(</big><em>path</em>, <em>parent</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_collect_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_collect_directory" title="Permalink to this definition">¶</a></dt>
<dd><p>called before traversing a directory for collection files.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.hookspec.pytest_collect_file">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_collect_file</tt><big>(</big><em>path</em>, <em>parent</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_collect_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_collect_file" title="Permalink to this definition">¶</a></dt>
<dd><p>return collection Node or None for the given path. Any new node
needs to have the specified <tt class="docutils literal"><span class="pre">parent</span></tt> as a parent.</p>
</dd></dl>

<p>For influencing the collection of objects in Python modules
you can use the following hook:</p>
<dl class="function">
<dt id="_pytest.hookspec.pytest_pycollect_makeitem">
<tt class="descclassname">_pytest.hookspec.</tt><tt class="descname">pytest_pycollect_makeitem</tt><big>(</big><em>collector</em>, <em>name</em>, <em>obj</em><big>)</big><a class="reference internal" href="_modules/_pytest/hookspec.html#pytest_pycollect_makeitem"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.hookspec.pytest_pycollect_makeitem" title="Permalink to this definition">¶</a></dt>
<dd><p>return custom item/collector for a python object in a module, or None.</p>
</dd></dl>

</div>
<div class="section" id="reporting-hooks">
<h2>Reporting hooks<a class="headerlink" href="#reporting-hooks" title="Permalink to this headline">¶</a></h2>
<p>Session related reporting hooks:</p>
<p>And here is the central hook for reporting about
test execution:</p>
</div>
</div>
<div class="section" id="reference-of-important-objects-involved-in-hooks">
<h1>Reference of important objects involved in hooks<a class="headerlink" href="#reference-of-important-objects-involved-in-hooks" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="_pytest.config.Config">
<em class="property">class </em><tt class="descclassname">_pytest.config.</tt><tt class="descname">Config</tt><big>(</big><em>pluginmanager=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Config" title="Permalink to this definition">¶</a></dt>
<dd><p>access to configuration values, pluginmanager and plugin hooks.</p>
<dl class="method">
<dt id="_pytest.config.Config.addinivalue_line">
<tt class="descname">addinivalue_line</tt><big>(</big><em>name</em>, <em>line</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Config.addinivalue_line"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Config.addinivalue_line" title="Permalink to this definition">¶</a></dt>
<dd><p>add a line to an ini-file option. The option must have been
declared but might not yet be set in which case the line becomes the
the first line in its value.</p>
</dd></dl>

<dl class="classmethod">
<dt id="_pytest.config.Config.fromdictargs">
<em class="property">classmethod </em><tt class="descname">fromdictargs</tt><big>(</big><em>option_dict</em>, <em>args</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Config.fromdictargs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Config.fromdictargs" title="Permalink to this definition">¶</a></dt>
<dd><p>constructor useable for subprocesses.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.config.Config.getini">
<tt class="descname">getini</tt><big>(</big><em>name</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Config.getini"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Config.getini" title="Permalink to this definition">¶</a></dt>
<dd><p>return configuration value from an ini file. If the
specified name hasn&#8217;t been registered through a prior <tt class="docutils literal"><span class="pre">parse.addini</span></tt>
call (usually from a plugin), a ValueError is raised.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.config.Config.getvalue">
<tt class="descname">getvalue</tt><big>(</big><em>name</em>, <em>path=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Config.getvalue"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Config.getvalue" title="Permalink to this definition">¶</a></dt>
<dd><p>return <tt class="docutils literal"><span class="pre">name</span></tt> value looked set from command line options.</p>
<p>(deprecated) if we can&#8217;t find the option also lookup
the name in a matching conftest file.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.config.Config.getvalueorskip">
<tt class="descname">getvalueorskip</tt><big>(</big><em>name</em>, <em>path=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Config.getvalueorskip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Config.getvalueorskip" title="Permalink to this definition">¶</a></dt>
<dd><p>(deprecated) return getvalue(name) or call
py.test.skip if no value exists.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.config.Config.option">
<tt class="descname">option</tt><a class="headerlink" href="#_pytest.config.Config.option" title="Permalink to this definition">¶</a></dt>
<dd><p>command line option values, usually added via parser.addoption(...)
or parser.getgroup(...).addoption(...) calls</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.config.Config.pluginmanager">
<tt class="descname">pluginmanager</tt><a class="headerlink" href="#_pytest.config.Config.pluginmanager" title="Permalink to this definition">¶</a></dt>
<dd><p>a pluginmanager instance</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="_pytest.config.Parser">
<em class="property">class </em><tt class="descclassname">_pytest.config.</tt><tt class="descname">Parser</tt><big>(</big><em>usage=None</em>, <em>processopt=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Parser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Parser" title="Permalink to this definition">¶</a></dt>
<dd><p>Parser for command line arguments.</p>
<dl class="method">
<dt id="_pytest.config.Parser.addini">
<tt class="descname">addini</tt><big>(</big><em>name</em>, <em>help</em>, <em>type=None</em>, <em>default=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Parser.addini"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Parser.addini" title="Permalink to this definition">¶</a></dt>
<dd><p>add an ini-file option with the given name and description.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.config.Parser.addoption">
<tt class="descname">addoption</tt><big>(</big><em>*opts</em>, <em>**attrs</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Parser.addoption"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Parser.addoption" title="Permalink to this definition">¶</a></dt>
<dd><p>add an optparse-style option.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.config.Parser.getgroup">
<tt class="descname">getgroup</tt><big>(</big><em>name</em>, <em>description=''</em>, <em>after=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/config.html#Parser.getgroup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.config.Parser.getgroup" title="Permalink to this definition">¶</a></dt>
<dd><p>get (or create) a named option Group.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Name :</th><td class="field-body">unique name of the option group.</td>
</tr>
<tr class="field"><th class="field-name">Description :</th><td class="field-body">long description for &#8211;help output.</td>
</tr>
<tr class="field"><th class="field-name">After :</th><td class="field-body">name of other group, used for ordering &#8211;help output.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="_pytest.main.Node">
<em class="property">class </em><tt class="descclassname">_pytest.main.</tt><tt class="descname">Node</tt><big>(</big><em>name</em>, <em>parent</em><big>)</big><a class="reference internal" href="_modules/_pytest/main.html#Node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.main.Node" title="Permalink to this definition">¶</a></dt>
<dd><p>base class for all Nodes in the collection tree.
Collector subclasses have children, Items are terminal nodes.</p>
<dl class="attribute">
<dt id="_pytest.main.Node.Class">
<tt class="descname">Class</tt><a class="headerlink" href="#_pytest.main.Node.Class" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated attribute &#8216;Class&#8217;, use pytest.Class</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.File">
<tt class="descname">File</tt><a class="headerlink" href="#_pytest.main.Node.File" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated attribute &#8216;File&#8217;, use pytest.File</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.Function">
<tt class="descname">Function</tt><a class="headerlink" href="#_pytest.main.Node.Function" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated attribute &#8216;Function&#8217;, use pytest.Function</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.Instance">
<tt class="descname">Instance</tt><a class="headerlink" href="#_pytest.main.Node.Instance" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated attribute &#8216;Instance&#8217;, use pytest.Instance</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.Item">
<tt class="descname">Item</tt><a class="headerlink" href="#_pytest.main.Node.Item" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated attribute &#8216;Item&#8217;, use pytest.Item</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.Module">
<tt class="descname">Module</tt><a class="headerlink" href="#_pytest.main.Node.Module" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated attribute &#8216;Module&#8217;, use pytest.Module</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.config">
<tt class="descname">config</tt><a class="headerlink" href="#_pytest.main.Node.config" title="Permalink to this definition">¶</a></dt>
<dd><p>the test config object</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.fspath">
<tt class="descname">fspath</tt><a class="headerlink" href="#_pytest.main.Node.fspath" title="Permalink to this definition">¶</a></dt>
<dd><p>filesystem path where this node was collected from</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.main.Node.listchain">
<tt class="descname">listchain</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/_pytest/main.html#Node.listchain"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.main.Node.listchain" title="Permalink to this definition">¶</a></dt>
<dd><p>return list of all parent collectors up to self,
starting from root of collection tree.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.name">
<tt class="descname">name</tt><a class="headerlink" href="#_pytest.main.Node.name" title="Permalink to this definition">¶</a></dt>
<dd><p>a unique name with the scope of the parent</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.parent">
<tt class="descname">parent</tt><a class="headerlink" href="#_pytest.main.Node.parent" title="Permalink to this definition">¶</a></dt>
<dd><p>the parent collector node.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.main.Node.session">
<tt class="descname">session</tt><a class="headerlink" href="#_pytest.main.Node.session" title="Permalink to this definition">¶</a></dt>
<dd><p>the collection this node is part of</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="_pytest.runner.CallInfo">
<em class="property">class </em><tt class="descclassname">_pytest.runner.</tt><tt class="descname">CallInfo</tt><big>(</big><em>func</em>, <em>when</em><big>)</big><a class="reference internal" href="_modules/_pytest/runner.html#CallInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.runner.CallInfo" title="Permalink to this definition">¶</a></dt>
<dd><p>Result/Exception info a function invocation.</p>
<dl class="attribute">
<dt id="_pytest.runner.CallInfo.excinfo">
<tt class="descname">excinfo</tt><a class="headerlink" href="#_pytest.runner.CallInfo.excinfo" title="Permalink to this definition">¶</a></dt>
<dd><p>None or ExceptionInfo object.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.CallInfo.when">
<tt class="descname">when</tt><a class="headerlink" href="#_pytest.runner.CallInfo.when" title="Permalink to this definition">¶</a></dt>
<dd><p>context of invocation: one of &#8220;setup&#8221;, &#8220;call&#8221;,
&#8220;teardown&#8221;, &#8220;memocollect&#8221;</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="_pytest.runner.TestReport">
<em class="property">class </em><tt class="descclassname">_pytest.runner.</tt><tt class="descname">TestReport</tt><big>(</big><em>nodeid</em>, <em>location</em>, <em>keywords</em>, <em>outcome</em>, <em>longrepr</em>, <em>when</em>, <em>sections=()</em>, <em>duration=0</em>, <em>**extra</em><big>)</big><a class="reference internal" href="_modules/_pytest/runner.html#TestReport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.runner.TestReport" title="Permalink to this definition">¶</a></dt>
<dd><p>Basic test report object (also used for setup and teardown calls if
they fail).</p>
<dl class="attribute">
<dt id="_pytest.runner.TestReport.duration">
<tt class="descname">duration</tt><a class="headerlink" href="#_pytest.runner.TestReport.duration" title="Permalink to this definition">¶</a></dt>
<dd><p>time it took to run just the test</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.keywords">
<tt class="descname">keywords</tt><a class="headerlink" href="#_pytest.runner.TestReport.keywords" title="Permalink to this definition">¶</a></dt>
<dd><p>a name -&gt; value dictionary containing all keywords and
markers associated with a test invocation.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.location">
<tt class="descname">location</tt><a class="headerlink" href="#_pytest.runner.TestReport.location" title="Permalink to this definition">¶</a></dt>
<dd><p>a (filesystempath, lineno, domaininfo) tuple indicating the
actual location of a test item - it might be different from the
collected one e.g. if a method is inherited from a different module.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.longrepr">
<tt class="descname">longrepr</tt><a class="headerlink" href="#_pytest.runner.TestReport.longrepr" title="Permalink to this definition">¶</a></dt>
<dd><p>None or a failure representation.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.nodeid">
<tt class="descname">nodeid</tt><a class="headerlink" href="#_pytest.runner.TestReport.nodeid" title="Permalink to this definition">¶</a></dt>
<dd><p>normalized collection node id</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.outcome">
<tt class="descname">outcome</tt><a class="headerlink" href="#_pytest.runner.TestReport.outcome" title="Permalink to this definition">¶</a></dt>
<dd><p>test outcome, always one of &#8220;passed&#8221;, &#8220;failed&#8221;, &#8220;skipped&#8221;.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.sections">
<tt class="descname">sections</tt><a class="headerlink" href="#_pytest.runner.TestReport.sections" title="Permalink to this definition">¶</a></dt>
<dd><p>list of (secname, data) extra information which needs to
marshallable</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.runner.TestReport.when">
<tt class="descname">when</tt><a class="headerlink" href="#_pytest.runner.TestReport.when" title="Permalink to this definition">¶</a></dt>
<dd><p>one of &#8216;setup&#8217;, &#8216;call&#8217;, &#8216;teardown&#8217; to indicate runtest phase.</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a></li>
        <li class="right" >
          <a href="talks.html" title="Talks and Tutorials"
             >next</a> |</li>
        <li class="right" >
          <a href="doctest.html" title="Doctest integration for modules and test files"
             >previous</a> |</li>
        <li><a href="contents.html">pytest-2.2.4</a> &raquo;</li>
 
<g:plusone></g:plusone>

      </ul>
    </div>

    <div class="footer">
        &copy; Copyright 2011, holger krekel et alii.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-7597274-13']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>

  </body>
</html>