2009-07-28 20:26:32 +08:00
|
|
|
|
|
|
|
pytest_keyword plugin
|
|
|
|
=====================
|
|
|
|
|
|
|
|
mark test functions with keywords that may hold values.
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
|
|
|
|
Marking functions and setting rich attributes
|
|
|
|
----------------------------------------------------
|
|
|
|
|
|
|
|
By default, all filename parts and class/function names of a test
|
|
|
|
function are put into the set of keywords for a given test. You can
|
|
|
|
specify additional kewords like this::
|
|
|
|
|
|
|
|
@py.test.mark.webtest
|
|
|
|
def test_send_http():
|
|
|
|
...
|
|
|
|
|
|
|
|
This will set an attribute 'webtest' on the given test function
|
|
|
|
and by default all such attributes signal keywords. You can
|
|
|
|
also set values in this attribute which you could read from
|
|
|
|
a hook in order to do something special with respect to
|
|
|
|
the test function::
|
|
|
|
|
|
|
|
@py.test.mark.timeout(seconds=5)
|
|
|
|
def test_receive():
|
|
|
|
...
|
|
|
|
|
|
|
|
This will set the "timeout" attribute with a Marker object
|
|
|
|
that has a 'seconds' attribute.
|
|
|
|
|
|
|
|
Start improving this plugin in 30 seconds
|
|
|
|
=========================================
|
|
|
|
|
|
|
|
|
|
|
|
Do you find the above documentation or the plugin itself lacking?
|
|
|
|
|
|
|
|
1. Download `pytest_keyword.py`_ plugin source code
|
|
|
|
2. put it somewhere as ``pytest_keyword.py`` into your import path
|
|
|
|
3. a subsequent ``py.test`` run will use your local version
|
|
|
|
|
|
|
|
Further information: extend_ documentation, other plugins_ or contact_.
|
|
|
|
|
2009-07-31 20:21:02 +08:00
|
|
|
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/6e9879aca934933c6065776820f22095634a7edf/py/test/plugin/pytest_keyword.py
|
2009-07-28 20:26:32 +08:00
|
|
|
.. _`extend`: ../extend.html
|
|
|
|
.. _`plugins`: index.html
|
|
|
|
.. _`contact`: ../../contact.html
|
|
|
|
.. _`checkout the py.test development version`: ../../download.html#checkout
|