You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
95
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
96
96
cachedir: .cache
97
97
rootdir: $REGENDOC_TMPDIR, inifile:
98
98
collecting ... collected 8 items
@@ -130,7 +130,7 @@ select tests based on their names::
130
130
131
131
$ py.test -v -k http # running with the above defined example module
132
132
======= test session starts ========
133
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
133
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
134
134
cachedir: .cache
135
135
rootdir: $REGENDOC_TMPDIR, inifile:
136
136
collecting ... collected 4 items
@@ -144,7 +144,7 @@ And you can also run all tests except the ones that match the keyword::
144
144
145
145
$ py.test -k "not send_http" -v
146
146
======= test session starts ========
147
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
147
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
148
148
cachedir: .cache
149
149
rootdir: $REGENDOC_TMPDIR, inifile:
150
150
collecting ... collected 4 items
@@ -160,7 +160,7 @@ Or to select "http" and "quick" tests::
160
160
161
161
$ py.test -k "http or quick" -v
162
162
======= test session starts ========
163
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
163
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
164
164
cachedir: .cache
165
165
rootdir: $REGENDOC_TMPDIR, inifile:
166
166
collecting ... collected 4 items
@@ -201,9 +201,11 @@ You can ask which markers exist for your test suite - the list includes our just
201
201
$ py.test --markers
202
202
@pytest.mark.webtest: mark a test as a webtest.
203
203
204
+
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
205
+
204
206
@pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html
205
207
206
-
@pytest.mark.xfail(condition, reason=None, run=True, raises=None): mark the the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html
208
+
@pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html
207
209
208
210
@pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see http://pytest.org/latest/parametrize.html for more info and examples.
209
211
@@ -350,7 +352,7 @@ the test needs::
350
352
351
353
$ py.test -E stage2
352
354
======= test session starts ========
353
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
355
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
354
356
rootdir: $REGENDOC_TMPDIR, inifile:
355
357
collected 1 items
356
358
@@ -362,7 +364,7 @@ and here is one that specifies exactly the environment needed::
362
364
363
365
$ py.test -E stage1
364
366
======= test session starts ========
365
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
367
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
366
368
rootdir: $REGENDOC_TMPDIR, inifile:
367
369
collected 1 items
368
370
@@ -375,9 +377,11 @@ The ``--markers`` option always gives you a list of available markers::
375
377
$ py.test --markers
376
378
@pytest.mark.env(name): mark test to run only on named environment
377
379
380
+
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
381
+
378
382
@pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html
379
383
380
-
@pytest.mark.xfail(condition, reason=None, run=True, raises=None): mark the the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html
384
+
@pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html
381
385
382
386
@pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see http://pytest.org/latest/parametrize.html for more info and examples.
383
387
@@ -481,7 +485,7 @@ then you will see two test skipped and two executed tests as expected::
481
485
482
486
$ py.test -rs # this option reports skip reasons
483
487
======= test session starts ========
484
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
488
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
485
489
rootdir: $REGENDOC_TMPDIR, inifile:
486
490
collected 4 items
487
491
@@ -495,7 +499,7 @@ Note that if you specify a platform via the marker-command line option like this
495
499
496
500
$ py.test -m linux2
497
501
======= test session starts ========
498
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
502
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
499
503
rootdir: $REGENDOC_TMPDIR, inifile:
500
504
collected 4 items
501
505
@@ -547,7 +551,7 @@ We can now use the ``-m option`` to select one set::
547
551
548
552
$ py.test -m interface --tb=short
549
553
======= test session starts ========
550
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
554
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
551
555
rootdir: $REGENDOC_TMPDIR, inifile:
552
556
collected 4 items
553
557
@@ -569,7 +573,7 @@ or to select both "event" and "interface" tests::
569
573
570
574
$ py.test -m "interface or event" --tb=short
571
575
======= test session starts ========
572
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
576
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
Copy file name to clipboardExpand all lines: doc/en/example/parametrize.rst
+8-11
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ objects, they are still using the default pytest representation::
130
130
131
131
$ py.test test_time.py --collect-only
132
132
======= test session starts ========
133
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
133
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
134
134
rootdir: $REGENDOC_TMPDIR, inifile:
135
135
collected 6 items
136
136
<Module 'test_time.py'>
@@ -181,7 +181,7 @@ this is a fully self-contained example which you can run with::
181
181
182
182
$ py.test test_scenarios.py
183
183
======= test session starts ========
184
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
184
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
185
185
rootdir: $REGENDOC_TMPDIR, inifile:
186
186
collected 4 items
187
187
@@ -194,7 +194,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
194
194
195
195
$ py.test --collect-only test_scenarios.py
196
196
======= test session starts ========
197
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
197
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
198
198
rootdir: $REGENDOC_TMPDIR, inifile:
199
199
collected 4 items
200
200
<Module 'test_scenarios.py'>
@@ -259,7 +259,7 @@ Let's first see how it looks like at collection time::
259
259
260
260
$ py.test test_backends.py --collect-only
261
261
======= test session starts ========
262
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
262
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
263
263
rootdir: $REGENDOC_TMPDIR, inifile:
264
264
collected 2 items
265
265
<Module 'test_backends.py'>
@@ -320,7 +320,7 @@ The result of this test will be successful::
320
320
321
321
$ py.test test_indirect_list.py --collect-only
322
322
======= test session starts ========
323
-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
323
+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
324
324
rootdir: $REGENDOC_TMPDIR, inifile:
325
325
collected 1 items
326
326
<Module 'test_indirect_list.py'>
@@ -397,11 +397,8 @@ is to be run with different sets of arguments for its three arguments:
397
397
Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize)::
398
398
399
399
. $ py.test -rs -q multipython.py
400
-
ssssssssssss...ssssssssssss
401
-
======= short test summary info ========
402
-
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python3.3' not found
403
-
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found
404
-
3 passed, 24 skipped in 0.12 seconds
400
+
...........................
401
+
27 passed in 0.12 seconds
405
402
406
403
Indirect parametrization of optional implementations/imports
0 commit comments