From 13dafbaaafd83e0ff9945932fd28deb8bf43e227 Mon Sep 17 00:00:00 2001 From: tligui_y Date: Sat, 19 Jul 2025 17:51:37 +0200 Subject: [PATCH] Update json_to_md.py --- json_to_md.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/json_to_md.py b/json_to_md.py index e231d5cb9..13d4e4737 100644 --- a/json_to_md.py +++ b/json_to_md.py @@ -68,7 +68,7 @@ def get_details_block_other_sections(summary, body, level=0): f"\n" f"\n\n") - +''' def make_test_block(test, status, emoji, level, runtime_params): nodeid = test.get("nodeid", "") callspec = runtime_params.get(nodeid, {}) @@ -98,6 +98,42 @@ def make_test_block(test, status, emoji, level, runtime_params): f" {body.strip()}\n" f" \n\n" ) +''' + +def make_test_block(test, status, emoji, level, runtime_params): + nodeid = test.get("nodeid", "") + callspec = runtime_params.get(nodeid, {}) + params = callspec.get("params", {}) if isinstance(callspec, dict) else {} + + # Résumé du test + summary = f"{emoji} Test {test['global_number']}" + if params: + param_display = ", ".join(f"{k}={sanitize_param_value(v)}" for k, v in params.items()) + summary += f"
(params: {param_display})" + + body = "" + + # Bloc pour les paramètres d'exécution + if callspec: + block = f"```python\n{stringify(callspec)}\n```" + body += f"**📌 Runtime Parameters**\n\n{block}\n\n" + + skip_keys = {"nodeid"} + for phase in [k for k in test if isinstance(test[k], dict) and k not in skip_keys]: + # Phases (Setup, Call, etc.) + body += f"
\n🔧 {phase.capitalize()} Phase\n\n" + for field, value in test[phase].items(): + # Ajoute les données à l'intérieur des phases + block = f"```python\n{stringify(value)}\n```" + body += f"**{field}:**\n\n{block}\n\n" + body += "
\n" # Fermeture de la balise
pour chaque phase + + return ( + f" -
\n" + f" {summary}\n\n" + f" {body.strip()}\n" + f"
\n\n" + )