This file is indexed.

/usr/share/doc/python-pytest/html/goodpractices.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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<!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>Good Integration Practices &#8212; 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="pytest import mechanisms and sys.path/PYTHONPATH" href="pythonpath.html" />
    <link rel="prev" title="Logging" href="logging.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="pythonpath.html" title="pytest import mechanisms and sys.path/PYTHONPATH"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="logging.html" title="Logging"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="contents.html">pytest-3.3</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="good-integration-practices">
<span id="goodpractices"></span><h1>Good Integration Practices<a class="headerlink" href="#good-integration-practices" title="Permalink to this headline"></a></h1>
<div class="section" id="conventions-for-python-test-discovery">
<span id="python-test-discovery"></span><span id="test-discovery"></span><h2>Conventions for Python test discovery<a class="headerlink" href="#conventions-for-python-test-discovery" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal"><span class="pre">pytest</span></code> implements the following standard test discovery:</p>
<ul class="simple">
<li>If no arguments are specified then collection starts from <a class="reference internal" href="customize.html#confval-testpaths"><code class="xref std std-confval docutils literal"><span class="pre">testpaths</span></code></a>
(if configured) or the current directory. Alternatively, command line arguments
can be used in any combination of directories, file names or node ids.</li>
<li>Recurse into directories, unless they match <a class="reference internal" href="customize.html#confval-norecursedirs"><code class="xref std std-confval docutils literal"><span class="pre">norecursedirs</span></code></a>.</li>
<li>In those directories, search for <code class="docutils literal"><span class="pre">test_*.py</span></code> or <code class="docutils literal"><span class="pre">*_test.py</span></code> files, imported by their <a class="reference internal" href="#test-package-name">test package name</a>.</li>
<li>From those files, collect test items:<ul>
<li><code class="docutils literal"><span class="pre">test_</span></code> prefixed test functions or methods outside of class</li>
<li><code class="docutils literal"><span class="pre">test_</span></code> prefixed test functions or methods inside <code class="docutils literal"><span class="pre">Test</span></code> prefixed test classes (without an <code class="docutils literal"><span class="pre">__init__</span></code> method)</li>
</ul>
</li>
</ul>
<p>For examples of how to customize your test discovery <a class="reference internal" href="example/pythoncollection.html"><span class="doc">Changing standard (Python) test discovery</span></a>.</p>
<p>Within Python modules, <code class="docutils literal"><span class="pre">pytest</span></code> also discovers tests using the standard
<a class="reference internal" href="unittest.html#unittest-testcase"><span class="std std-ref">unittest.TestCase</span></a> subclassing technique.</p>
</div>
<div class="section" id="choosing-a-test-layout-import-rules">
<h2>Choosing a test layout / import rules<a class="headerlink" href="#choosing-a-test-layout-import-rules" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal"><span class="pre">pytest</span></code> supports two common test layouts:</p>
<div class="section" id="tests-outside-application-code">
<h3>Tests outside application code<a class="headerlink" href="#tests-outside-application-code" title="Permalink to this headline"></a></h3>
<p>Putting tests into an extra directory outside your actual application code
might be useful if you have many functional tests or for other reasons want
to keep tests separate from actual application code (often a good idea):</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">setup</span><span class="o">.</span><span class="n">py</span>
<span class="n">mypkg</span><span class="o">/</span>
    <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
    <span class="n">app</span><span class="o">.</span><span class="n">py</span>
    <span class="n">view</span><span class="o">.</span><span class="n">py</span>
<span class="n">tests</span><span class="o">/</span>
    <span class="n">test_app</span><span class="o">.</span><span class="n">py</span>
    <span class="n">test_view</span><span class="o">.</span><span class="n">py</span>
    <span class="o">...</span>
</pre></div>
</div>
<p>This way your tests can run easily against an installed version
of <code class="docutils literal"><span class="pre">mypkg</span></code>.</p>
<p>Note that using this scheme your test files must have <strong>unique names</strong>, because
<code class="docutils literal"><span class="pre">pytest</span></code> will import them as <em>top-level</em> modules since there are no packages
to derive a full package name from. In other words, the test files in the example above will
be imported as <code class="docutils literal"><span class="pre">test_app</span></code> and <code class="docutils literal"><span class="pre">test_view</span></code> top-level modules by adding <code class="docutils literal"><span class="pre">tests/</span></code> to
<code class="docutils literal"><span class="pre">sys.path</span></code>.</p>
<p>If you need to have test modules with the same name, you might add <code class="docutils literal"><span class="pre">__init__.py</span></code> files to your
<code class="docutils literal"><span class="pre">tests</span></code> folder and subfolders, changing them to packages:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">setup</span><span class="o">.</span><span class="n">py</span>
<span class="n">mypkg</span><span class="o">/</span>
    <span class="o">...</span>
<span class="n">tests</span><span class="o">/</span>
    <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
    <span class="n">foo</span><span class="o">/</span>
        <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
        <span class="n">test_view</span><span class="o">.</span><span class="n">py</span>
    <span class="n">bar</span><span class="o">/</span>
        <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
        <span class="n">test_view</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>Now pytest will load the modules as <code class="docutils literal"><span class="pre">tests.foo.test_view</span></code> and <code class="docutils literal"><span class="pre">tests.bar.test_view</span></code>, allowing
you to have modules with the same name. But now this introduces a subtle problem: in order to load
the test modules from the <code class="docutils literal"><span class="pre">tests</span></code> directory, pytest prepends the root of the repository to
<code class="docutils literal"><span class="pre">sys.path</span></code>, which adds the side-effect that now <code class="docutils literal"><span class="pre">mypkg</span></code> is also importable.
This is problematic if you are using a tool like <a class="reference external" href="http://testrun.org/tox">tox</a> to test your package in a virtual environment,
because you want to test the <em>installed</em> version of your package, not the local code from the repository.</p>
<p>In this situation, it is <strong>strongly</strong> suggested to use a <code class="docutils literal"><span class="pre">src</span></code> layout where application root package resides in a
sub-directory of your root:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">setup</span><span class="o">.</span><span class="n">py</span>
<span class="n">src</span><span class="o">/</span>
    <span class="n">mypkg</span><span class="o">/</span>
        <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
        <span class="n">app</span><span class="o">.</span><span class="n">py</span>
        <span class="n">view</span><span class="o">.</span><span class="n">py</span>
<span class="n">tests</span><span class="o">/</span>
    <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
    <span class="n">foo</span><span class="o">/</span>
        <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
        <span class="n">test_view</span><span class="o">.</span><span class="n">py</span>
    <span class="n">bar</span><span class="o">/</span>
        <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
        <span class="n">test_view</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>This layout prevents a lot of common pitfalls and has many benefits, which are better explained in this excellent
<a class="reference external" href="https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure">blog post by Ionel Cristian Mărieș</a>.</p>
</div>
<div class="section" id="tests-as-part-of-application-code">
<h3>Tests as part of application code<a class="headerlink" href="#tests-as-part-of-application-code" title="Permalink to this headline"></a></h3>
<p>Inlining test directories into your application package
is useful if you have direct relation between tests and application modules and
want to distribute them along with your application:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">setup</span><span class="o">.</span><span class="n">py</span>
<span class="n">mypkg</span><span class="o">/</span>
    <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
    <span class="n">app</span><span class="o">.</span><span class="n">py</span>
    <span class="n">view</span><span class="o">.</span><span class="n">py</span>
    <span class="n">test</span><span class="o">/</span>
        <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span>
        <span class="n">test_app</span><span class="o">.</span><span class="n">py</span>
        <span class="n">test_view</span><span class="o">.</span><span class="n">py</span>
        <span class="o">...</span>
</pre></div>
</div>
<p>In this scheme, it is easy to run your tests using the <code class="docutils literal"><span class="pre">--pyargs</span></code> option:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">pytest</span> <span class="o">--</span><span class="n">pyargs</span> <span class="n">mypkg</span>
</pre></div>
</div>
<p><code class="docutils literal"><span class="pre">pytest</span></code> will discover where <code class="docutils literal"><span class="pre">mypkg</span></code> is installed and collect tests from there.</p>
<p>Note that this layout also works in conjunction with the <code class="docutils literal"><span class="pre">src</span></code> layout mentioned in the previous section.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You can use Python3 namespace packages (PEP420) for your application
but pytest will still perform <a class="reference internal" href="#test-package-name">test package name</a> discovery based on the
presence of <code class="docutils literal"><span class="pre">__init__.py</span></code> files.  If you use one of the
two recommended file system layouts above but leave away the <code class="docutils literal"><span class="pre">__init__.py</span></code>
files from your directories it should just work on Python3.3 and above.  From
&quot;inlined tests&quot;, however, you will need to use absolute imports for
getting at your application code.</p>
</div>
<div class="admonition note" id="test-package-name">
<p class="first admonition-title">Note</p>
<p>If <code class="docutils literal"><span class="pre">pytest</span></code> finds a &quot;a/b/test_module.py&quot; test file while
recursing into the filesystem it determines the import name
as follows:</p>
<ul class="simple">
<li>determine <code class="docutils literal"><span class="pre">basedir</span></code>: this is the first &quot;upward&quot; (towards the root)
directory not containing an <code class="docutils literal"><span class="pre">__init__.py</span></code>.  If e.g. both <code class="docutils literal"><span class="pre">a</span></code>
and <code class="docutils literal"><span class="pre">b</span></code> contain an <code class="docutils literal"><span class="pre">__init__.py</span></code> file then the parent directory
of <code class="docutils literal"><span class="pre">a</span></code> will become the <code class="docutils literal"><span class="pre">basedir</span></code>.</li>
<li>perform <code class="docutils literal"><span class="pre">sys.path.insert(0,</span> <span class="pre">basedir)</span></code> to make the test module
importable under the fully qualified import name.</li>
<li><code class="docutils literal"><span class="pre">import</span> <span class="pre">a.b.test_module</span></code> where the path is determined
by converting path separators <code class="docutils literal"><span class="pre">/</span></code> into &quot;.&quot; characters.  This means
you must follow the convention of having directory and file
names map directly to the import names.</li>
</ul>
<p class="last">The reason for this somewhat evolved importing technique is
that in larger projects multiple test modules might import
from each other and thus deriving a canonical import name helps
to avoid surprises such as a test module getting imported twice.</p>
</div>
</div>
</div>
<div class="section" id="tox">
<span id="use-tox"></span><h2>Tox<a class="headerlink" href="#tox" title="Permalink to this headline"></a></h2>
<p>For development, we recommend to use <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> environments and <a class="reference external" href="http://pypi.python.org/pypi/pip">pip</a>
for installing your application and any dependencies
as well as the <code class="docutils literal"><span class="pre">pytest</span></code> package itself. This ensures your code and
dependencies are isolated from the system Python installation.</p>
<p>You can then install your package in &quot;editable&quot; mode:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">e</span> <span class="o">.</span>
</pre></div>
</div>
<p>which lets you change your source code (both tests and application) and rerun tests at will.
This is similar to running <cite>python setup.py develop</cite> or <cite>conda develop</cite> in that it installs
your package using a symlink to your development code.</p>
<p>Once you are done with your work and want to make sure that your actual
package passes all tests you may want to look into <a class="reference external" href="http://testrun.org/tox">tox</a>, the
virtualenv test automation tool and its <a class="reference external" href="https://tox.readthedocs.io/en/latest/example/pytest.html">pytest support</a>.
Tox helps you to setup virtualenv environments with pre-defined
dependencies and then executing a pre-configured test command with
options.  It will run tests against the installed package and not
against your source code checkout, helping to detect packaging
glitches.</p>
</div>
<div class="section" id="integrating-with-setuptools-python-setup-py-test-pytest-runner">
<h2>Integrating with setuptools / <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></code> / <code class="docutils literal"><span class="pre">pytest-runner</span></code><a class="headerlink" href="#integrating-with-setuptools-python-setup-py-test-pytest-runner" title="Permalink to this headline"></a></h2>
<p>You can integrate test runs into your setuptools based project
with the <a class="reference external" href="https://pypi.python.org/pypi/pytest-runner">pytest-runner</a> plugin.</p>
<p>Add this to <code class="docutils literal"><span class="pre">setup.py</span></code> file:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">setuptools</span> <span class="kn">import</span> <span class="n">setup</span>

<span class="n">setup</span><span class="p">(</span>
    <span class="c1">#...,</span>
    <span class="n">setup_requires</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;pytest-runner&#39;</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span>
    <span class="n">tests_require</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;pytest&#39;</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span>
    <span class="c1">#...,</span>
<span class="p">)</span>
</pre></div>
</div>
<p>And create an alias into <code class="docutils literal"><span class="pre">setup.cfg</span></code> file:</p>
<div class="highlight-ini"><div class="highlight"><pre><span></span><span class="k">[aliases]</span>
<span class="na">test</span><span class="o">=</span><span class="s">pytest</span>
</pre></div>
</div>
<p>If you now type:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">test</span>
</pre></div>
</div>
<p>this will execute your tests using <code class="docutils literal"><span class="pre">pytest-runner</span></code>. As this is a
standalone version of <code class="docutils literal"><span class="pre">pytest</span></code> no prior installation whatsoever is
required for calling the test command. You can also pass additional
arguments to pytest such as your test directory or other
options using <code class="docutils literal"><span class="pre">--addopts</span></code>.</p>
<p>You can also specify other pytest-ini options in your <code class="docutils literal"><span class="pre">setup.cfg</span></code> file
by putting them into a <code class="docutils literal"><span class="pre">[tool:pytest]</span></code> section:</p>
<div class="highlight-ini"><div class="highlight"><pre><span></span><span class="k">[tool:pytest]</span>
<span class="na">addopts</span> <span class="o">=</span> <span class="s">--verbose</span>
<span class="na">python_files</span> <span class="o">=</span> <span class="s">testing/*/*.py</span>
</pre></div>
</div>
<div class="section" id="manual-integration">
<h3>Manual Integration<a class="headerlink" href="#manual-integration" title="Permalink to this headline"></a></h3>
<p>If for some reason you don't want/can't use <code class="docutils literal"><span class="pre">pytest-runner</span></code>, you can write
your own setuptools Test command for invoking pytest.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>

<span class="kn">from</span> <span class="nn">setuptools.command.test</span> <span class="kn">import</span> <span class="n">test</span> <span class="k">as</span> <span class="n">TestCommand</span>


<span class="k">class</span> <span class="nc">PyTest</span><span class="p">(</span><span class="n">TestCommand</span><span class="p">):</span>
    <span class="n">user_options</span> <span class="o">=</span> <span class="p">[(</span><span class="s1">&#39;pytest-args=&#39;</span><span class="p">,</span> <span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="s2">&quot;Arguments to pass to pytest&quot;</span><span class="p">)]</span>

    <span class="k">def</span> <span class="nf">initialize_options</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">TestCommand</span><span class="o">.</span><span class="n">initialize_options</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">pytest_args</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>

    <span class="k">def</span> <span class="nf">run_tests</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="kn">import</span> <span class="nn">shlex</span>
        <span class="c1">#import here, cause outside the eggs aren&#39;t loaded</span>
        <span class="kn">import</span> <span class="nn">pytest</span>
        <span class="n">errno</span> <span class="o">=</span> <span class="n">pytest</span><span class="o">.</span><span class="n">main</span><span class="p">(</span><span class="n">shlex</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pytest_args</span><span class="p">))</span>
        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="n">errno</span><span class="p">)</span>


<span class="n">setup</span><span class="p">(</span>
    <span class="c1">#...,</span>
    <span class="n">tests_require</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;pytest&#39;</span><span class="p">],</span>
    <span class="n">cmdclass</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;test&#39;</span><span class="p">:</span> <span class="n">PyTest</span><span class="p">},</span>
    <span class="p">)</span>
</pre></div>
</div>
<p>Now if you run:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">test</span>
</pre></div>
</div>
<p>this will download <code class="docutils literal"><span class="pre">pytest</span></code> if needed and then run your tests
as you would expect it to. You can pass a single string of arguments
using the <code class="docutils literal"><span class="pre">--pytest-args</span></code> or <code class="docutils literal"><span class="pre">-a</span></code> command-line option. For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">test</span> <span class="o">-</span><span class="n">a</span> <span class="s2">&quot;--durations=5&quot;</span>
</pre></div>
</div>
<p>is equivalent to running <code class="docutils literal"><span class="pre">pytest</span> <span class="pre">--durations=5</span></code>.</p>
</div>
</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="#">Good Integration Practices</a><ul>
<li><a class="reference internal" href="#conventions-for-python-test-discovery">Conventions for Python test discovery</a></li>
<li><a class="reference internal" href="#choosing-a-test-layout-import-rules">Choosing a test layout / import rules</a><ul>
<li><a class="reference internal" href="#tests-outside-application-code">Tests outside application code</a></li>
<li><a class="reference internal" href="#tests-as-part-of-application-code">Tests as part of application code</a></li>
</ul>
</li>
<li><a class="reference internal" href="#tox">Tox</a></li>
<li><a class="reference internal" href="#integrating-with-setuptools-python-setup-py-test-pytest-runner">Integrating with setuptools / <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></code> / <code class="docutils literal"><span class="pre">pytest-runner</span></code></a><ul>
<li><a class="reference internal" href="#manual-integration">Manual Integration</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
  <li><a href="contents.html">Documentation overview</a><ul>
      <li>Previous: <a href="logging.html" title="previous chapter">Logging</a></li>
      <li>Next: <a href="pythonpath.html" title="next chapter">pytest import mechanisms and <code class="docutils literal"><span class="pre">sys.path</span></code>/<code class="docutils literal"><span class="pre">PYTHONPATH</span></code></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">
    &copy; Copyright 2018, holger krekel and pytest-dev team.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  </div>
  

  </body>
</html>