This file is indexed.

/usr/share/doc/python-pytest-doc/html/builtin.html is in python-pytest-doc 2.6.3-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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<!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>Pytest API and builtin fixtures</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:     '2.6.2',
        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="shortcut icon" href="_static/pytest1favi.ico"/>
    <link rel="top" title="None" href="index.html" />
    <link rel="up" title="pytest reference documentation" href="apiref.html" />
    <link rel="next" title="Basic test configuration" href="customize.html" />
    <link rel="prev" title="pytest reference documentation" href="apiref.html" />
   
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

  </head>
  <body>
  
  

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="customize.html" title="Basic test configuration"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="apiref.html" title="pytest reference documentation"
             accesskey="P">previous</a> |</li>
        <li><a href="contents.html">pytest-2.6.2</a> &raquo;</li>
          <li><a href="apiref.html" accesskey="U">pytest reference documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="pytest-api-and-builtin-fixtures">
<span id="pytest-helpers"></span><h1>Pytest API and builtin fixtures<a class="headerlink" href="#pytest-api-and-builtin-fixtures" title="Permalink to this headline"></a></h1>
<p>This is a list of <tt class="docutils literal"><span class="pre">pytest.*</span></tt> API functions and fixtures.</p>
<p>For information on plugin hooks and objects, see <a class="reference internal" href="plugins.html#plugins"><em>Working with plugins and conftest files</em></a>.</p>
<p>For information on the <tt class="docutils literal"><span class="pre">pytest.mark</span></tt> mechanism, see <a class="reference internal" href="mark.html#mark"><em>Marking test functions with attributes</em></a>.</p>
<p>For the below objects, you can also interactively ask for help, e.g. by
typing on the Python interactive prompt something like:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">pytest</span>
<span class="n">help</span><span class="p">(</span><span class="n">pytest</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="invoking-pytest-interactively">
<h2>Invoking pytest interactively<a class="headerlink" href="#invoking-pytest-interactively" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pytest.main">
<tt class="descname">main</tt><big>(</big><em>args=None</em>, <em>plugins=None</em><big>)</big><a class="headerlink" href="#pytest.main" title="Permalink to this definition"></a></dt>
<dd><p>return exit code, after performing an in-process test run.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>args</strong> &#8211; list of command line arguments.</li>
<li><strong>plugins</strong> &#8211; list of plugin objects to be auto-registered during
initialization.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<p>More examples at <a class="reference internal" href="usage.html#pytest-main-usage"><em>Calling pytest from Python code</em></a></p>
</div>
<div class="section" id="helpers-for-assertions-about-exceptions-warnings">
<h2>Helpers for assertions about Exceptions/Warnings<a class="headerlink" href="#helpers-for-assertions-about-exceptions-warnings" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pytest.raises">
<tt class="descname">raises</tt><big>(</big><em>ExpectedException</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#pytest.raises" title="Permalink to this definition"></a></dt>
<dd><p>assert that a code block/function call raises &#64;ExpectedException
and raise a failure exception otherwise.</p>
<p>This helper produces a <tt class="docutils literal"><span class="pre">py.code.ExceptionInfo()</span></tt> object.</p>
<p>If using Python 2.5 or above, you may use this function as a
context manager:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="n">raises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">):</span>
<span class="gp">... </span>   <span class="mi">1</span><span class="o">/</span><span class="mi">0</span>
</pre></div>
</div>
<p>Or you can specify a callable by passing a to-be-called lambda:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">raises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">,</span> <span class="k">lambda</span><span class="p">:</span> <span class="mi">1</span><span class="o">/</span><span class="mi">0</span><span class="p">)</span>
<span class="go">&lt;ExceptionInfo ...&gt;</span>
</pre></div>
</div>
<p>or you can specify an arbitrary callable with arguments:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">):</span> <span class="k">return</span> <span class="mi">1</span><span class="o">/</span><span class="n">x</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">raises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="go">&lt;ExceptionInfo ...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">raises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">x</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
<span class="go">&lt;ExceptionInfo ...&gt;</span>
</pre></div>
</div>
<p>A third possibility is to use a string to be executed:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">raises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">,</span> <span class="s">&quot;f(0)&quot;</span><span class="p">)</span>
<span class="go">&lt;ExceptionInfo ...&gt;</span>
</pre></div>
</div>
<p>Similar to caught exception objects in Python, explicitly clearing
local references to returned <tt class="docutils literal"><span class="pre">py.code.ExceptionInfo</span></tt> objects can
help the Python interpreter speed up its garbage collection.</p>
<p>Clearing those references breaks a reference cycle
(<tt class="docutils literal"><span class="pre">ExceptionInfo</span></tt> &#8211;&gt; caught exception &#8211;&gt; frame stack raising
the exception &#8211;&gt; current frame stack &#8211;&gt; local variables &#8211;&gt;
<tt class="docutils literal"><span class="pre">ExceptionInfo</span></tt>) which makes Python keep all objects referenced
from that cycle (including all local variables in the current
frame) alive until the next cyclic garbage collection run. See the
official Python <tt class="docutils literal"><span class="pre">try</span></tt> statement documentation for more detailed
information.</p>
</dd></dl>

<p>Examples at <a class="reference internal" href="assert.html#assertraises"><em>Assertions about expected exceptions</em></a>.</p>
<dl class="function">
<dt id="pytest.deprecated_call">
<tt class="descname">deprecated_call</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#pytest.deprecated_call" title="Permalink to this definition"></a></dt>
<dd><p>assert that calling <tt class="docutils literal"><span class="pre">func(*args,</span> <span class="pre">**kwargs)</span></tt>
triggers a DeprecationWarning.</p>
</dd></dl>

</div>
<div class="section" id="raising-a-specific-test-outcome">
<h2>Raising a specific test outcome<a class="headerlink" href="#raising-a-specific-test-outcome" title="Permalink to this headline"></a></h2>
<p>You can use the following functions in your test, fixture or setup
functions to force a certain test outcome.  Note that most often
you can rather use declarative marks, see <a class="reference internal" href="skipping.html#skipping"><em>Skip and xfail: dealing with tests that can not succeed</em></a>.</p>
<dl class="function">
<dt id="_pytest.runner.fail">
<tt class="descname">fail</tt><big>(</big><em>msg=''</em>, <em>pytrace=True</em><big>)</big><a class="reference internal" href="_modules/_pytest/runner.html#fail"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.runner.fail" title="Permalink to this definition"></a></dt>
<dd><p>explicitely fail an currently-executing test with the given Message.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pytrace</strong> &#8211; if false the msg represents the full failure information
and no python traceback will be reported.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="_pytest.runner.skip">
<tt class="descname">skip</tt><big>(</big><em>msg=''</em><big>)</big><a class="reference internal" href="_modules/_pytest/runner.html#skip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.runner.skip" title="Permalink to this definition"></a></dt>
<dd><p>skip an executing test with the given message.  Note: it&#8217;s usually
better to use the pytest.mark.skipif marker to declare a test to be
skipped under certain conditions like mismatching platforms or
dependencies.  See the pytest_skipping plugin for details.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.runner.importorskip">
<tt class="descname">importorskip</tt><big>(</big><em>modname</em>, <em>minversion=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/runner.html#importorskip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.runner.importorskip" title="Permalink to this definition"></a></dt>
<dd><p>return imported module if it has at least &#8220;minversion&#8221; as its
__version__ attribute.  If no minversion is specified the a skip
is only triggered if the module can not be imported.
Note that version comparison only works with simple version strings
like &#8220;1.2.3&#8221; but not &#8220;1.2.3.dev1&#8221; or others.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.skipping.xfail">
<tt class="descname">xfail</tt><big>(</big><em>reason=''</em><big>)</big><a class="reference internal" href="_modules/_pytest/skipping.html#xfail"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.skipping.xfail" title="Permalink to this definition"></a></dt>
<dd><p>xfail an executing test or setup functions with the given reason.</p>
</dd></dl>

<dl class="function">
<dt id="_pytest.runner.exit">
<tt class="descname">exit</tt><big>(</big><em>msg</em><big>)</big><a class="reference internal" href="_modules/_pytest/runner.html#exit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.runner.exit" title="Permalink to this definition"></a></dt>
<dd><p>exit testing process as if KeyboardInterrupt was triggered.</p>
</dd></dl>

</div>
<div class="section" id="fixtures-and-requests">
<h2>fixtures and requests<a class="headerlink" href="#fixtures-and-requests" title="Permalink to this headline"></a></h2>
<p>To mark a fixture function:</p>
<dl class="function">
<dt id="_pytest.python.fixture">
<tt class="descname">fixture</tt><big>(</big><em>scope='function'</em>, <em>params=None</em>, <em>autouse=False</em>, <em>ids=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/python.html#fixture"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.fixture" title="Permalink to this definition"></a></dt>
<dd><p>(return a) decorator to mark a fixture factory function.</p>
<p>This decorator can be used (with or or without parameters) to define
a fixture function.  The name of the fixture function can later be
referenced to cause its invocation ahead of running tests: test
modules or classes can use the pytest.mark.usefixtures(fixturename)
marker.  Test functions can directly use fixture names as input
arguments in which case the fixture instance returned from the fixture
function will be injected.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>scope</strong> &#8211; the scope for which this fixture is shared, one of
&#8220;function&#8221; (default), &#8220;class&#8221;, &#8220;module&#8221;, &#8220;session&#8221;.</li>
<li><strong>params</strong> &#8211; an optional list of parameters which will cause multiple
invocations of the fixture function and all of the tests
using it.</li>
<li><strong>autouse</strong> &#8211; if True, the fixture func is activated for all tests that
can see it.  If False (the default) then an explicit
reference is needed to activate the fixture.</li>
<li><strong>ids</strong> &#8211; list of string ids each corresponding to the params
so that they are part of the test id. If no ids are provided
they will be generated automatically from the params.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<p>Tutorial at <a class="reference internal" href="fixture.html#fixtures"><em>pytest fixtures: explicit, modular, scalable</em></a>.</p>
<p>The <tt class="docutils literal"><span class="pre">request</span></tt> object that can be used from fixture functions.</p>
<dl class="class">
<dt id="_pytest.python.FixtureRequest">
<em class="property">class </em><tt class="descname">FixtureRequest</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest" title="Permalink to this definition"></a></dt>
<dd><p>A request for a fixture from a test or fixture function.</p>
<p>A request object gives access to the requesting test context
and has an optional <tt class="docutils literal"><span class="pre">param</span></tt> attribute in case
the fixture is parametrized indirectly.</p>
<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.fixturename">
<tt class="descname">fixturename</tt><em class="property"> = None</em><a class="headerlink" href="#_pytest.python.FixtureRequest.fixturename" title="Permalink to this definition"></a></dt>
<dd><p>fixture for which this request is being performed</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.scope">
<tt class="descname">scope</tt><em class="property"> = None</em><a class="headerlink" href="#_pytest.python.FixtureRequest.scope" title="Permalink to this definition"></a></dt>
<dd><p>Scope string, one of &#8220;function&#8221;, &#8220;cls&#8221;, &#8220;module&#8221;, &#8220;session&#8221;</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.node">
<tt class="descname">node</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.node" title="Permalink to this definition"></a></dt>
<dd><p>underlying collection node (depends on current request scope)</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.config">
<tt class="descname">config</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.config" title="Permalink to this definition"></a></dt>
<dd><p>the pytest config object associated with this request.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.function">
<tt class="descname">function</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.function"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.function" title="Permalink to this definition"></a></dt>
<dd><p>test function object if the request has a per-function scope.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.cls">
<tt class="descname">cls</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.cls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.cls" title="Permalink to this definition"></a></dt>
<dd><p>class (can be None) where the test function was collected.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.instance">
<tt class="descname">instance</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.instance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.instance" title="Permalink to this definition"></a></dt>
<dd><p>instance (can be None) on which test function was collected.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.module">
<tt class="descname">module</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.module" title="Permalink to this definition"></a></dt>
<dd><p>python module object where the test function was collected.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.fspath">
<tt class="descname">fspath</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.fspath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.fspath" title="Permalink to this definition"></a></dt>
<dd><p>the file system path of the test module which collected this test.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.keywords">
<tt class="descname">keywords</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.keywords"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.keywords" title="Permalink to this definition"></a></dt>
<dd><p>keywords/markers dictionary for the underlying node.</p>
</dd></dl>

<dl class="attribute">
<dt id="_pytest.python.FixtureRequest.session">
<tt class="descname">session</tt><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.session"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.session" title="Permalink to this definition"></a></dt>
<dd><p>pytest session object.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.python.FixtureRequest.addfinalizer">
<tt class="descname">addfinalizer</tt><big>(</big><em>finalizer</em><big>)</big><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.addfinalizer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.addfinalizer" title="Permalink to this definition"></a></dt>
<dd><p>add finalizer/teardown function to be called after the
last test within the requesting test context finished
execution.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.python.FixtureRequest.applymarker">
<tt class="descname">applymarker</tt><big>(</big><em>marker</em><big>)</big><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.applymarker"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.applymarker" title="Permalink to this definition"></a></dt>
<dd><p>Apply a marker to a single test function invocation.
This method is useful if you don&#8217;t want to have a keyword/marker
on all function invocations.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>marker</strong> &#8211; a <a class="reference internal" href="mark.html#_pytest.mark.MarkDecorator" title="_pytest.mark.MarkDecorator"><tt class="xref py py-class docutils literal"><span class="pre">_pytest.mark.MarkDecorator</span></tt></a> object
created by a call to <tt class="docutils literal"><span class="pre">pytest.mark.NAME(...)</span></tt>.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="_pytest.python.FixtureRequest.raiseerror">
<tt class="descname">raiseerror</tt><big>(</big><em>msg</em><big>)</big><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.raiseerror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.raiseerror" title="Permalink to this definition"></a></dt>
<dd><p>raise a FixtureLookupError with the given message.</p>
</dd></dl>

<dl class="method">
<dt id="_pytest.python.FixtureRequest.cached_setup">
<tt class="descname">cached_setup</tt><big>(</big><em>setup</em>, <em>teardown=None</em>, <em>scope='module'</em>, <em>extrakey=None</em><big>)</big><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.cached_setup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.cached_setup" title="Permalink to this definition"></a></dt>
<dd><p>(deprecated) Return a testing resource managed by <tt class="docutils literal"><span class="pre">setup</span></tt> &amp;
<tt class="docutils literal"><span class="pre">teardown</span></tt> calls.  <tt class="docutils literal"><span class="pre">scope</span></tt> and <tt class="docutils literal"><span class="pre">extrakey</span></tt> determine when the
<tt class="docutils literal"><span class="pre">teardown</span></tt> function will be called so that subsequent calls to
<tt class="docutils literal"><span class="pre">setup</span></tt> would recreate the resource.  With pytest-2.3 you often
do not need <tt class="docutils literal"><span class="pre">cached_setup()</span></tt> as you can directly declare a scope
on a fixture function and register a finalizer through
<tt class="docutils literal"><span class="pre">request.addfinalizer()</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-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>teardown</strong> &#8211; function receiving a previously setup resource.</li>
<li><strong>setup</strong> &#8211; a no-argument function creating a resource.</li>
<li><strong>scope</strong> &#8211; a string value out of <tt class="docutils literal"><span class="pre">function</span></tt>, <tt class="docutils literal"><span class="pre">class</span></tt>, <tt class="docutils literal"><span class="pre">module</span></tt>
or <tt class="docutils literal"><span class="pre">session</span></tt> indicating the caching lifecycle of the resource.</li>
<li><strong>extrakey</strong> &#8211; added to internal caching key of (funcargname, scope).</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="_pytest.python.FixtureRequest.getfuncargvalue">
<tt class="descname">getfuncargvalue</tt><big>(</big><em>argname</em><big>)</big><a class="reference internal" href="_modules/_pytest/python.html#FixtureRequest.getfuncargvalue"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.FixtureRequest.getfuncargvalue" title="Permalink to this definition"></a></dt>
<dd><p>Dynamically retrieve a named fixture function argument.</p>
<p>As of pytest-2.3, it is easier and usually better to access other
fixture values by stating it as an input argument in the fixture
function.  If you only can decide about using another fixture at test
setup time, you may use this function to retrieve it inside a fixture
function body.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="builtin-fixtures-function-arguments">
<span id="builtinfuncargs"></span><span id="builtinfixtures"></span><h2>Builtin fixtures/function arguments<a class="headerlink" href="#builtin-fixtures-function-arguments" title="Permalink to this headline"></a></h2>
<p>You can ask for available builtin or project-custom
<a class="reference internal" href="fixture.html#fixtures"><em>fixtures</em></a> by typing:</p>
<div class="highlight-python"><div class="highlight"><pre>$ py.test -q --fixtures
capsys
    enables capturing of writes to sys.stdout/sys.stderr and makes
    captured output available via ``capsys.readouterr()`` method calls
    which return a ``(out, err)`` tuple.

capfd
    enables capturing of writes to file descriptors 1 and 2 and makes
    captured output available via ``capfd.readouterr()`` method calls
    which return a ``(out, err)`` tuple.

monkeypatch
    The returned ``monkeypatch`` funcarg provides these
    helper methods to modify objects, dictionaries or os.environ::

    monkeypatch.setattr(obj, name, value, raising=True)
    monkeypatch.delattr(obj, name, raising=True)
    monkeypatch.setitem(mapping, name, value)
    monkeypatch.delitem(obj, name, raising=True)
    monkeypatch.setenv(name, value, prepend=False)
    monkeypatch.delenv(name, value, raising=True)
    monkeypatch.syspath_prepend(path)
    monkeypatch.chdir(path)

    All modifications will be undone after the requesting
    test function has finished. The ``raising``
    parameter determines if a KeyError or AttributeError
    will be raised if the set/deletion operation has no target.

pytestconfig
    the pytest config object with access to command line opts.
recwarn
    Return a WarningsRecorder instance that provides these methods:

    * ``pop(category=None)``: return last warning matching the category.
    * ``clear()``: clear list of warnings

    See http://docs.python.org/library/warnings.html for information
    on warning categories.

tmpdir
    return a temporary directory path object
    which is unique to each test function invocation,
    created as a sub directory of the base temporary
    directory.  The returned object is a `py.path.local`_
    path object.


 in 0.00 seconds
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <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>
</ul>
  <hr>
  <ul>
<li><a class="reference internal" href="#">Pytest API and builtin fixtures</a><ul>
<li><a class="reference internal" href="#invoking-pytest-interactively">Invoking pytest interactively</a></li>
<li><a class="reference internal" href="#helpers-for-assertions-about-exceptions-warnings">Helpers for assertions about Exceptions/Warnings</a></li>
<li><a class="reference internal" href="#raising-a-specific-test-outcome">Raising a specific test outcome</a></li>
<li><a class="reference internal" href="#fixtures-and-requests">fixtures and requests</a></li>
<li><a class="reference internal" href="#builtin-fixtures-function-arguments">Builtin fixtures/function arguments</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
  <li><a href="contents.html">Documentation overview</a><ul>
  <li><a href="apiref.html">pytest reference documentation</a><ul>
      <li>Previous: <a href="apiref.html" title="previous chapter">pytest reference documentation</a></li>
      <li>Next: <a href="customize.html" title="next chapter">Basic test configuration</a></li>
  </ul></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://bitbucket.org/hpk42/pytest/">pytest @ Bitbucket</a></li>
  <li><a href="http://pytest.org/latest/plugins_index/index.html">3rd party plugins</a></li>
  <li><a href="https://bitbucket.org/hpk42/pytest/issues?status=new&status=open">Issue Tracker</a></li>
  <li><a href="http://pytest.org/latest/pytest.pdf">PDF Documentation</a>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>

  <div class="footer">
    &copy; Copyright 2014, holger krekel.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  </div>
  

  </body>
</html>