This file is indexed.

/usr/share/doc/python-pytest-doc/html/parametrize.html is in python-pytest-doc 2.8.7-4.

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
<!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>Parametrizing fixtures and test functions</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.8.7',
        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="contents.html" />
   
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

  </head>
  <body role="document">
  
  

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="nav-item nav-item-0"><a href="contents.html">pytest-2.8.7</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="parametrizing-fixtures-and-test-functions">
<span id="parametrize-basics"></span><span id="parametrize"></span><span id="parametrized-test-functions"></span><span id="parametrizing-tests"></span><span id="test-generators"></span><h1>Parametrizing fixtures and test functions<a class="headerlink" href="#parametrizing-fixtures-and-test-functions" title="Permalink to this headline"></a></h1>
<p>pytest supports test parametrization in several well-integrated ways:</p>
<ul class="simple">
<li><code class="xref py py-func docutils literal"><span class="pre">pytest.fixture()</span></code> allows to define <a class="reference internal" href="fixture.html#fixture-parametrize"><span>parametrization
at the level of fixture functions</span></a>.</li>
</ul>
<ul class="simple">
<li><a class="reference internal" href="#pytest-mark-parametrize">&#64;pytest.mark.parametrize</a> allows to define parametrization at the
function or class level, provides multiple argument/fixture sets
for a particular test function or class.</li>
<li><a class="reference internal" href="#pytest-generate-tests">pytest_generate_tests</a> enables implementing your own custom
dynamic parametrization scheme or extensions.</li>
</ul>
<div class="section" id="pytest-mark-parametrize-parametrizing-test-functions">
<span id="pytest-mark-parametrize"></span><span id="parametrizemark"></span><h2><code class="docutils literal"><span class="pre">&#64;pytest.mark.parametrize</span></code>: parametrizing test functions<a class="headerlink" href="#pytest-mark-parametrize-parametrizing-test-functions" title="Permalink to this headline"></a></h2>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.2.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.4: </span>Several improvements.</p>
</div>
<p>The builtin <code class="docutils literal"><span class="pre">pytest.mark.parametrize</span></code> decorator enables
parametrization of arguments for a test function.  Here is a typical example
of a test function that implements checking that a certain input leads
to an expected output:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># content of test_expectation.py</span>
<span class="kn">import</span> <span class="nn">pytest</span>
<span class="nd">@pytest.mark.parametrize</span><span class="p">(</span><span class="s2">&quot;test_input,expected&quot;</span><span class="p">,</span> <span class="p">[</span>
    <span class="p">(</span><span class="s2">&quot;3+5&quot;</span><span class="p">,</span> <span class="mi">8</span><span class="p">),</span>
    <span class="p">(</span><span class="s2">&quot;2+4&quot;</span><span class="p">,</span> <span class="mi">6</span><span class="p">),</span>
    <span class="p">(</span><span class="s2">&quot;6*9&quot;</span><span class="p">,</span> <span class="mi">42</span><span class="p">),</span>
<span class="p">])</span>
<span class="k">def</span> <span class="nf">test_eval</span><span class="p">(</span><span class="n">test_input</span><span class="p">,</span> <span class="n">expected</span><span class="p">):</span>
    <span class="k">assert</span> <span class="nb">eval</span><span class="p">(</span><span class="n">test_input</span><span class="p">)</span> <span class="o">==</span> <span class="n">expected</span>
</pre></div>
</div>
<p>Here, the <code class="docutils literal"><span class="pre">&#64;parametrize</span></code> decorator defines three different <code class="docutils literal"><span class="pre">(test_input,expected)</span></code>
tuples so that the <code class="docutils literal"><span class="pre">test_eval</span></code> function will run three times using
them in turn:</p>
<div class="highlight-python"><div class="highlight"><pre>$ py.test
======= test session starts ========
platform linux -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 3 items

test_expectation.py ..F

======= FAILURES ========
_______ test_eval[6*9-42] ________

test_input = &#39;6*9&#39;, expected = 42

    @pytest.mark.parametrize(&quot;test_input,expected&quot;, [
        (&quot;3+5&quot;, 8),
        (&quot;2+4&quot;, 6),
        (&quot;6*9&quot;, 42),
    ])
    def test_eval(test_input, expected):
&gt;       assert eval(test_input) == expected
E       assert 54 == 42
E        +  where 54 = eval(&#39;6*9&#39;)

test_expectation.py:8: AssertionError
======= 1 failed, 2 passed in 0.12 seconds ========
</pre></div>
</div>
<p>As designed in this example, only one pair of input/output values fails
the simple test function.  And as usual with test function arguments,
you can see the <code class="docutils literal"><span class="pre">input</span></code> and <code class="docutils literal"><span class="pre">output</span></code> values in the traceback.</p>
<p>Note that you could also use the parametrize marker on a class or a module
(see <a class="reference internal" href="mark.html#mark"><span>Marking test functions with attributes</span></a>) which would invoke several functions with the argument sets.</p>
<p>It is also possible to mark individual test instances within parametrize,
for example with the builtin <code class="docutils literal"><span class="pre">mark.xfail</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># content of test_expectation.py</span>
<span class="kn">import</span> <span class="nn">pytest</span>
<span class="nd">@pytest.mark.parametrize</span><span class="p">(</span><span class="s2">&quot;test_input,expected&quot;</span><span class="p">,</span> <span class="p">[</span>
    <span class="p">(</span><span class="s2">&quot;3+5&quot;</span><span class="p">,</span> <span class="mi">8</span><span class="p">),</span>
    <span class="p">(</span><span class="s2">&quot;2+4&quot;</span><span class="p">,</span> <span class="mi">6</span><span class="p">),</span>
    <span class="n">pytest</span><span class="o">.</span><span class="n">mark</span><span class="o">.</span><span class="n">xfail</span><span class="p">((</span><span class="s2">&quot;6*9&quot;</span><span class="p">,</span> <span class="mi">42</span><span class="p">)),</span>
<span class="p">])</span>
<span class="k">def</span> <span class="nf">test_eval</span><span class="p">(</span><span class="n">test_input</span><span class="p">,</span> <span class="n">expected</span><span class="p">):</span>
    <span class="k">assert</span> <span class="nb">eval</span><span class="p">(</span><span class="n">test_input</span><span class="p">)</span> <span class="o">==</span> <span class="n">expected</span>
</pre></div>
</div>
<p>Let&#8217;s run this:</p>
<div class="highlight-python"><div class="highlight"><pre>$ py.test
======= test session starts ========
platform linux -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 3 items

test_expectation.py ..x

======= 2 passed, 1 xfailed in 0.12 seconds ========
</pre></div>
</div>
<p>The one parameter set which caused a failure previously now
shows up as an &#8220;xfailed (expected to fail)&#8221; test.</p>
<p>To get all combinations of multiple parametrized arguments you can stack
<code class="docutils literal"><span class="pre">parametrize</span></code> decorators:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">pytest</span>
<span class="nd">@pytest.mark.parametrize</span><span class="p">(</span><span class="s2">&quot;x&quot;</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="nd">@pytest.mark.parametrize</span><span class="p">(</span><span class="s2">&quot;y&quot;</span><span class="p">,</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">test_foo</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">):</span>
    <span class="k">pass</span>
</pre></div>
</div>
<p>This will run the test with the arguments set to x=0/y=2, x=0/y=3, x=1/y=2 and
x=1/y=3.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">In versions prior to 2.4 one needed to specify the argument
names as a tuple.  This remains valid but the simpler <code class="docutils literal"><span class="pre">&quot;name1,name2,...&quot;</span></code>
comma-separated-string syntax is now advertised first because
it&#8217;s easier to write and produces less line noise.</p>
</div>
</div>
<div class="section" id="basic-pytest-generate-tests-example">
<span id="pytest-generate-tests"></span><h2>Basic <code class="docutils literal"><span class="pre">pytest_generate_tests</span></code> example<a class="headerlink" href="#basic-pytest-generate-tests-example" title="Permalink to this headline"></a></h2>
<p>Sometimes you may want to implement your own parametrization scheme
or implement some dynamism for determining the parameters or scope
of a fixture.   For this, you can use the <code class="docutils literal"><span class="pre">pytest_generate_tests</span></code> hook
which is called when collecting a test function.  Through the passed in
<cite>metafunc</cite> object you can inspect the requesting test context and, most
importantly, you can call <code class="docutils literal"><span class="pre">metafunc.parametrize()</span></code> to cause
parametrization.</p>
<p>For example, let&#8217;s say we want to run a test taking string inputs which
we want to set via a new <code class="docutils literal"><span class="pre">pytest</span></code> command line option.  Let&#8217;s first write
a simple test accepting a <code class="docutils literal"><span class="pre">stringinput</span></code> fixture function argument:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># content of test_strings.py</span>

<span class="k">def</span> <span class="nf">test_valid_string</span><span class="p">(</span><span class="n">stringinput</span><span class="p">):</span>
    <span class="k">assert</span> <span class="n">stringinput</span><span class="o">.</span><span class="n">isalpha</span><span class="p">()</span>
</pre></div>
</div>
<p>Now we add a <code class="docutils literal"><span class="pre">conftest.py</span></code> file containing the addition of a
command line option and the parametrization of our test function:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># content of conftest.py</span>

<span class="k">def</span> <span class="nf">pytest_addoption</span><span class="p">(</span><span class="n">parser</span><span class="p">):</span>
    <span class="n">parser</span><span class="o">.</span><span class="n">addoption</span><span class="p">(</span><span class="s2">&quot;--stringinput&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;append&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="p">[],</span>
        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;list of stringinputs to pass to test functions&quot;</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">pytest_generate_tests</span><span class="p">(</span><span class="n">metafunc</span><span class="p">):</span>
    <span class="k">if</span> <span class="s1">&#39;stringinput&#39;</span> <span class="ow">in</span> <span class="n">metafunc</span><span class="o">.</span><span class="n">fixturenames</span><span class="p">:</span>
        <span class="n">metafunc</span><span class="o">.</span><span class="n">parametrize</span><span class="p">(</span><span class="s2">&quot;stringinput&quot;</span><span class="p">,</span>
                             <span class="n">metafunc</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">option</span><span class="o">.</span><span class="n">stringinput</span><span class="p">)</span>
</pre></div>
</div>
<p>If we now pass two stringinput values, our test will run twice:</p>
<div class="highlight-python"><div class="highlight"><pre>$ py.test -q --stringinput=&quot;hello&quot; --stringinput=&quot;world&quot; test_strings.py
..
2 passed in 0.12 seconds
</pre></div>
</div>
<p>Let&#8217;s also run with a stringinput that will lead to a failing test:</p>
<div class="highlight-python"><div class="highlight"><pre>$ py.test -q --stringinput=&quot;!&quot; test_strings.py
F
======= FAILURES ========
_______ test_valid_string[!] ________

stringinput = &#39;!&#39;

    def test_valid_string(stringinput):
&gt;       assert stringinput.isalpha()
E       assert &lt;built-in method isalpha of str object at 0xdeadbeef&gt;()
E        +  where &lt;built-in method isalpha of str object at 0xdeadbeef&gt; = &#39;!&#39;.isalpha

test_strings.py:3: AssertionError
1 failed in 0.12 seconds
</pre></div>
</div>
<p>As expected our test function fails.</p>
<p>If you don&#8217;t specify a stringinput it will be skipped because
<code class="docutils literal"><span class="pre">metafunc.parametrize()</span></code> will be called with an empty parameter
list:</p>
<div class="highlight-python"><div class="highlight"><pre>$ py.test -q -rs test_strings.py
s
======= short test summary info ========
SKIP [1] $PYTHON_PREFIX/lib/python3.4/site-packages/_pytest/python.py:1417: got empty parameter set, function test_valid_string at $REGENDOC_TMPDIR/test_strings.py:1
1 skipped in 0.12 seconds
</pre></div>
</div>
<p>For further examples, you might want to look at <a class="reference internal" href="example/parametrize.html#paramexamples"><span>more
parametrization examples</span></a>.</p>
</div>
<div class="section" id="the-metafunc-object">
<span id="metafunc-object"></span><h2>The <strong>metafunc</strong> object<a class="headerlink" href="#the-metafunc-object" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="_pytest.python.Metafunc">
<em class="property">class </em><code class="descname">Metafunc</code><span class="sig-paren">(</span><em>function</em>, <em>fixtureinfo</em>, <em>config</em>, <em>cls=None</em>, <em>module=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/_pytest/python.html#Metafunc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.Metafunc" title="Permalink to this definition"></a></dt>
<dd><p>Metafunc objects are passed to the <code class="docutils literal"><span class="pre">pytest_generate_tests</span></code> hook.
They help to inspect a test function and to generate tests according to
test configuration or values specified in the class or module where a
test function is defined.</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">Variables:</th><td class="field-body"><ul class="first last simple">
<li><strong>fixturenames</strong> &#8211; set of fixture names required by the test function</li>
<li><a class="reference internal" href="builtin.html#_pytest.python.FixtureRequest.function" title="_pytest.python.FixtureRequest.function"><strong>function</strong></a> &#8211; underlying python test function</li>
<li><a class="reference internal" href="builtin.html#_pytest.python.FixtureRequest.cls" title="_pytest.python.FixtureRequest.cls"><strong>cls</strong></a> &#8211; class object where the test function is defined in or <code class="docutils literal"><span class="pre">None</span></code>.</li>
<li><a class="reference internal" href="builtin.html#_pytest.python.FixtureRequest.module" title="_pytest.python.FixtureRequest.module"><strong>module</strong></a> &#8211; the module object where the test function is defined in.</li>
<li><a class="reference internal" href="builtin.html#_pytest.python.FixtureRequest.config" title="_pytest.python.FixtureRequest.config"><strong>config</strong></a> &#8211; access to the <a class="reference internal" href="writing_plugins.html#_pytest.config.Config" title="_pytest.config.Config"><code class="xref py py-class docutils literal"><span class="pre">_pytest.config.Config</span></code></a> object for the
test session.</li>
<li><strong>funcargnames</strong> &#8211; <div class="deprecated">
<p><span class="versionmodified">Deprecated since version 2.3: </span>Use <code class="docutils literal"><span class="pre">fixturenames</span></code> instead.</p>
</div>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="_pytest.python.Metafunc.parametrize">
<code class="descname">parametrize</code><span class="sig-paren">(</span><em>argnames</em>, <em>argvalues</em>, <em>indirect=False</em>, <em>ids=None</em>, <em>scope=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/_pytest/python.html#Metafunc.parametrize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.Metafunc.parametrize" title="Permalink to this definition"></a></dt>
<dd><p>Add new invocations to the underlying test function using the list
of argvalues for the given argnames.  Parametrization is performed
during the collection phase.  If you need to setup expensive resources
see about setting indirect to do it rather at test setup time.</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>argnames</strong> &#8211; a comma-separated string denoting one or more argument
names, or a list/tuple of argument strings.</li>
<li><strong>argvalues</strong> &#8211; The list of argvalues determines how often a
test is invoked with different argument values.  If only one
argname was specified argvalues is a list of values.  If N
argnames were specified, argvalues must be a list of N-tuples,
where each tuple-element specifies a value for its respective
argname.</li>
<li><strong>indirect</strong> &#8211; The list of argnames or boolean. A list of arguments&#8217;
names (subset of argnames). If True the list contains all names from
the argnames. Each argvalue corresponding to an argname in this list will
be passed as request.param to its respective argname fixture
function so that it can perform more expensive setups during the
setup phase of a test rather than at collection time.</li>
<li><strong>ids</strong> &#8211; list of string ids, or a callable.
If strings, each is corresponding to the argvalues so that they are
part of the test id.
If callable, it should take one argument (a single argvalue) and return
a string or return None. If None, the automatically generated id for that
argument will be used.
If no ids are provided they will be generated automatically from
the argvalues.</li>
<li><strong>scope</strong> &#8211; if specified it denotes the scope of the parameters.
The scope is used for grouping tests by parameter instances.
It will also override any fixture-function defined scope, allowing
to set a dynamic scope using test context or configuration.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="_pytest.python.Metafunc.addcall">
<code class="descname">addcall</code><span class="sig-paren">(</span><em>funcargs=None</em>, <em>id=_notexists</em>, <em>param=_notexists</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/_pytest/python.html#Metafunc.addcall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#_pytest.python.Metafunc.addcall" title="Permalink to this definition"></a></dt>
<dd><p>(deprecated, use parametrize) Add a new call to the underlying
test function during the collection phase of a test run.  Note that
request.addcall() is called during the test collection phase prior and
independently to actual test execution.  You should only use addcall()
if you need to specify multiple arguments of a test function.</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>funcargs</strong> &#8211; argument keyword dictionary used when invoking
the test function.</li>
<li><strong>id</strong> &#8211; used for reporting and identification purposes.  If you
don&#8217;t supply an <cite>id</cite> an automatic unique id will be generated.</li>
<li><strong>param</strong> &#8211; a parameter which will be exposed to a later fixture function
invocation through the <code class="docutils literal"><span class="pre">request.param</span></code> attribute.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</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>
</ul>
  <hr>
  <ul>
<li><a class="reference internal" href="#">Parametrizing fixtures and test functions</a><ul>
<li><a class="reference internal" href="#pytest-mark-parametrize-parametrizing-test-functions"><code class="docutils literal"><span class="pre">&#64;pytest.mark.parametrize</span></code>: parametrizing test functions</a></li>
<li><a class="reference internal" href="#basic-pytest-generate-tests-example">Basic <code class="docutils literal"><span class="pre">pytest_generate_tests</span></code> example</a></li>
<li><a class="reference internal" href="#the-metafunc-object">The <strong>metafunc</strong> object</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
  <li><a href="contents.html">Documentation overview</a><ul>
  </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="http://pytest.org/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">
      <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 2015, holger krekel and pytest-dev team.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  </div>
  

  </body>
</html>