numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
147 stars 39 forks source link

add support for record_property #58

Closed andrmuel closed 3 years ago

andrmuel commented 3 years ago

Note: As my knowledge of pytest-internals is very limited (to basically zero), I can't say much more than "works on my machine".

The code is inspired from what pytest itself does in the junitxml reporter. The relevant code seems to be (from src/_pytest/junitxml.py in function pytest_runtest_logreport):

for propname, propvalue in report.user_properties:
    reporter.add_property(propname, str(propvalue))
numirias commented 3 years ago

Thanks! I just added a few safeguards. (Closing #57)

andrmuel commented 3 years ago

Thanks – just updated to the latest version and using it in my code now.