Closed jacebrowning closed 6 years ago
That's not currently possible but definitely a useful addition! Should be quick to implement, I'll let you know when it's done.
There is now a json_metadata
fixture to add metadata to the current test item, e.g.:
def test_something(json_metadata):
json_metadata['foo'] = {"some": "thing"}
The readme also lists some other ways to customize the report if you want to add more than just per-test metadata. Let me know if that works for you.
I think pytest_json_modifyreport
will do what I need. Thanks!
Did this plugin add that?
No, that block is added by pytest-metadata
, right here. If you want an option to disable it, you might want to file an issue over there. :)
FYI, clearing the metadata is as simple as:
def pytest_configure(config):
config._metadata.clear()
Yep, thanks, although I took your question more being about disabling the output in the terminal report, not removing metadata entirely. (I also had submitted a patch over there so that now metadata is only displayed in the terminal report if you use --verbose
.) But it's also good to know how to remove it entirely.
Is there any way to insert additional fields into each test's JSON object?
Specifically, I am capturing my own logs during each test and would like to make the path to each of these log files available in the report.