test_ok2/doc/test/plugin/keyword.txt

52 lines
1.4 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' to True on the given test function.
You can read the value 'webtest' from the functions __dict__ later.
You can also set values for an attribute which are put on an empty
dummy object::
@py.test.mark.webtest(firefox=30)
def test_receive():
...
after which ``test_receive.webtest.firefox == 30`` holds true.
In addition to keyword arguments you can also use positional arguments::
@py.test.mark.webtest("triangular")
def test_receive():
...
after which ``test_receive.webtest._1 == 'triangular`` hold true.
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