Skip to content

Commit 4644a6f

Browse files
authored
Merge pull request #1079 from launchableinc/support-deps
pytest: Enhance JSON report parsing to handle user properties
2 parents 44bda06 + 3924318 commit 4644a6f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

launchable/test_runners/pytest.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,23 @@ 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')
314+
if isinstance(props, list):
315+
if len(props) > 0:
316+
props = {'properties': props}
317+
else:
318+
props = None
319+
303320
test_path = _parse_pytest_nodeid(nodeid)
304321
for path in test_path:
305322
if path.get("type") == "file":
@@ -310,4 +327,5 @@ def parse_func(
310327
duration_secs=data.get("duration", 0),
311328
status=status,
312329
stdout=stdout,
313-
stderr=stderr)
330+
stderr=stderr,
331+
data=props)

0 commit comments

Comments
 (0)