Improve pytestconfig and add record_xml_property
This commit is contained in:
parent
7ba8a4ee75
commit
111c6d6a22
|
@ -923,7 +923,15 @@ defaultfuncargprefixmarker = fixture()
|
|||
|
||||
@fixture(scope="session")
|
||||
def pytestconfig(request):
|
||||
""" the pytest config object with access to command line opts."""
|
||||
"""Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
|
||||
|
||||
Example::
|
||||
|
||||
def test_foo(pytestconfig):
|
||||
if pytestconfig.getoption("verbose"):
|
||||
...
|
||||
|
||||
"""
|
||||
return request.config
|
||||
|
||||
|
||||
|
|
|
@ -200,6 +200,11 @@ def record_xml_property(request):
|
|||
"""Add extra xml properties to the tag for the calling test.
|
||||
The fixture is callable with ``(name, value)``, with value being automatically
|
||||
xml-encoded.
|
||||
|
||||
Example::
|
||||
|
||||
def test_function(record_xml_property):
|
||||
record_xml_property("example_key", 1)
|
||||
"""
|
||||
request.node.warn(
|
||||
code='C3',
|
||||
|
|
|
@ -416,5 +416,10 @@ The ``request`` fixture is a special fixture providing information of the reques
|
|||
pytestconfig
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Scoped-session fixture which returns the internal :class:`_pytest.config.Config` object.
|
||||
.. autofunction:: _pytest.fixtures.pytestconfig()
|
||||
|
||||
|
||||
record_xml_property
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autofunction:: _pytest.junitxml.record_xml_property()
|
||||
|
|
Loading…
Reference in New Issue