Update json_to_md.py
Run Pytest with HTML and XML Test Reports / tests (push) Successful in 23s

This commit is contained in:
2025-07-19 17:51:37 +02:00
parent 9f61dad535
commit 13dafbaaaf
+37 -1
View File
@@ -68,7 +68,7 @@ def get_details_block_other_sections(summary, body, level=0):
f"</details>\n"
f"</div>\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" </details>\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"<br><span style='color: #888; font-size: 0.9em;'>(params: {param_display})</span>"
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"<details>\n<summary><strong>🔧 {phase.capitalize()} Phase</strong></summary>\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 += "</details>\n" # Fermeture de la balise <details> pour chaque phase
return (
f" - <details>\n"
f" <summary>{summary}</summary>\n\n"
f" {body.strip()}\n"
f" </details>\n\n"
)