45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
|
|
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
|
|
=========================================
|
|
|
|
|
|
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
|
|
|
|
Checkout customize_, other plugins_ or `get in contact`_.
|
|
|
|
.. include:: links.txt
|