Skip to content

Commit 3f7be31

Browse files
committed
pytest: Enhance JSON report parsing to handle user properties
1 parent cf9abbd commit 3f7be31

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

launchable/test_runners/pytest.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,20 @@ def parse_func(
300300
# https://github.com/pytest-dev/pytest/blob/1d7d63555e431d4562bcacbdc97038b0613d20ba/src/_pytest/nodes.py#L470
301301
stderr = longrepr
302302

303+
"""example json
304+
"user_properties": [
305+
["name", "dependency"],
306+
["args", []],
307+
["kwargs", { "name": "c", "depends": ["a"] }],
308+
["name", "order"],
309+
["args", [2]],
310+
["kwargs", {}]
311+
]
312+
"""
313+
props = data.get('user_properties', None)
314+
if props is not None:
315+
props = {'properties': props}
316+
303317
test_path = _parse_pytest_nodeid(nodeid)
304318
for path in test_path:
305319
if path.get("type") == "file":
@@ -310,4 +324,5 @@ def parse_func(
310324
duration_secs=data.get("duration", 0),
311325
status=status,
312326
stdout=stdout,
313-
stderr=stderr)
327+
stderr=stderr,
328+
data=props if props else {},)

0 commit comments

Comments
 (0)