Skip to content

Commit 0c94174

Browse files
committed
Add hypothesis information to the JSON report metadata
1 parent d094951 commit 0c94174

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

reporting.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,13 @@ def add_api_name_to_metadata(request, json_metadata):
6161
if hasattr(request.node, 'callspec'):
6262
params = request.node.callspec.params
6363
json_metadata['params'] = to_json_serializable(params)
64+
65+
def finalizer():
66+
# TODO: This metadata is all in the form of error strings. It might be
67+
# nice to extract the hypothesis failing inputs directly somehow.
68+
if hasattr(request.node, 'hypothesis_report_information'):
69+
json_metadata['hypothesis_report_information'] = request.node.hypothesis_report_information
70+
if hasattr(request.node, 'hypothesis_statistics'):
71+
json_metadata['hypothesis_statistics'] = request.node.hypothesis_statistics
72+
73+
request.addfinalizer(finalizer)

0 commit comments

Comments
 (0)