MCPcopy Create free account
hub / github.com/pytest-dev/pytest / record_property

Function record_property

src/_pytest/junitxml.py:282–301  ·  view source on GitHub ↗

Add extra properties to the calling test. User properties become part of the test report and are available to the configured reporters, like JUnit XML. The fixture is callable with ``name, value``. The value is automatically XML-encoded. Example:: def test_function(re

(request: FixtureRequest)

Source from the content-addressed store, hash-verified

280
281@pytest.fixture
282def record_property(request: FixtureRequest) -> Callable[[str, object], None]:
283 """Add extra properties to the calling test.
284
285 User properties become part of the test report and are available to the
286 configured reporters, like JUnit XML.
287
288 The fixture is callable with ``name, value``. The value is automatically
289 XML-encoded.
290
291 Example::
292
293 def test_function(record_property):
294 record_property("example_key", 1)
295 """
296 _warn_incompatibility_with_xunit2(request, "record_property")
297
298 def append_property(name: str, value: object) -> None:
299 request.node.user_properties.append((name, value))
300
301 return append_property
302
303
304@pytest.fixture

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected