Update json_to_md.py
This commit is contained in:
+16
-8
@@ -12,11 +12,15 @@ def json_to_adaptive_md(json_path, md_path):
|
||||
f.write(f"# 🏗 Rapport de Tests (Générique)\n")
|
||||
f.write(f"*Généré le {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n\n")
|
||||
|
||||
# Section Summary dynamique
|
||||
if 'summary' in data:
|
||||
f.write("## 📋 Summary\n")
|
||||
for key, value in data['summary'].items():
|
||||
f.write(f"- **{key.capitalize()}:** `{value}`\n")
|
||||
|
||||
total_duration = data.get('duration')
|
||||
if total_duration is not None:
|
||||
f.write(f"- **Durée totale:** `{total_duration:.3f}` s\n")
|
||||
|
||||
f.write("\n")
|
||||
|
||||
# Traitement hiérarchique automatique
|
||||
@@ -41,15 +45,19 @@ def json_to_adaptive_md(json_path, md_path):
|
||||
f.write(f" - Param {i}: `{param}`\n")
|
||||
|
||||
# Métadonnées communes
|
||||
f.write(f"- **Statut:** {'✅ Passed' if test['outcome'] == 'passed' else '❌ Failed'}\n")
|
||||
if 'duration' in test:
|
||||
f.write(f"- **Durée:** {test['duration']:.3f}s\n")
|
||||
if "outcome" in test:
|
||||
f.write(f"- **Statut:** `{test['outcome']}`\n")
|
||||
|
||||
if "call" in test and "duration" in test["call"]:
|
||||
f.write(f"- **Durée:** `{test['call']['duration']:.3f}`s\n")
|
||||
|
||||
# Détails spécifiques au résultat
|
||||
if test['outcome'] != 'passed':
|
||||
for key in ['message', 'longrepr', 'crash']:
|
||||
if key in test:
|
||||
f.write(f"\n**{key.capitalize()}:**\n```\n{str(test[key])}\n```\n")
|
||||
if test.get("outcome") != "passed":
|
||||
call_data = test.get("call", {})
|
||||
if call_data:
|
||||
f.write("\n**Détails (raw call):**\n")
|
||||
for key, value in call_data.items():
|
||||
f.write(f"\n- **{key}:**\n```\n{str(value)}\n```\n")
|
||||
|
||||
f.write("\n" + "-"*50 + "\n")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user