2009-10-23 02:57:21 +08:00
|
|
|
|
2010-10-11 05:45:45 +08:00
|
|
|
.. _mark:
|
|
|
|
|
2011-09-06 17:43:42 +08:00
|
|
|
Marking test functions with attributes
|
2010-10-13 18:26:14 +08:00
|
|
|
=================================================================
|
2010-01-13 23:00:33 +08:00
|
|
|
|
2010-11-13 18:10:45 +08:00
|
|
|
.. currentmodule:: _pytest.mark
|
2010-10-14 01:30:00 +08:00
|
|
|
|
2011-11-12 06:56:06 +08:00
|
|
|
By using the ``pytest.mark`` helper you can easily set
|
2011-11-19 02:32:11 +08:00
|
|
|
metadata on your test functions. There are
|
2011-11-12 06:56:06 +08:00
|
|
|
some builtin markers, for example:
|
2009-10-23 02:57:21 +08:00
|
|
|
|
2011-11-17 19:09:21 +08:00
|
|
|
* :ref:`skipif <skipif>` - skip a test function if a certain condition is met
|
|
|
|
* :ref:`xfail <xfail>` - produce an "expected failure" outcome if a certain
|
2011-11-12 06:56:06 +08:00
|
|
|
condition is met
|
2011-11-17 19:09:21 +08:00
|
|
|
* :ref:`parametrize <parametrizemark>` to perform multiple calls
|
|
|
|
to the same test function.
|
2011-11-12 06:56:06 +08:00
|
|
|
|
2011-11-19 02:32:11 +08:00
|
|
|
It's easy to create custom markers or to apply markers
|
|
|
|
to whole test classes or modules. See :ref:`mark examples` for examples
|
|
|
|
which also serve as documentation.
|
2011-11-12 06:56:06 +08:00
|
|
|
|
2010-10-14 01:30:00 +08:00
|
|
|
|
2010-10-13 18:26:14 +08:00
|
|
|
API reference for mark related objects
|
|
|
|
------------------------------------------------
|
2009-11-06 00:46:14 +08:00
|
|
|
|
2010-10-14 01:30:00 +08:00
|
|
|
.. autoclass:: MarkGenerator
|
|
|
|
:members:
|
|
|
|
|
|
|
|
.. autoclass:: MarkDecorator
|
|
|
|
:members:
|
|
|
|
|
|
|
|
.. autoclass:: MarkInfo
|
|
|
|
:members:
|
2009-10-23 02:57:21 +08:00
|
|
|
|