From 3bc06d296631a254d100c15fd8ff07019e5c380a Mon Sep 17 00:00:00 2001 From: tligui_y Date: Thu, 10 Jul 2025 15:53:22 +0200 Subject: [PATCH] Update json_to_md.py --- json_to_md.py | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/json_to_md.py b/json_to_md.py index ef6e4089..0c5010bb 100644 --- a/json_to_md.py +++ b/json_to_md.py @@ -154,19 +154,42 @@ def json_to_md_nested(json_path, md_path, allure_dir=None): f.write(f"- **Sévérité:** `{allure_info['severity']}`\n") if status != "passed": + # Debug 1: Afficher toutes les phases disponibles all_phases = [k for k, v in test.items() if isinstance(v, dict)] - try: - middle_phases = all_phases[all_phases.index('call')+1 : all_phases.index('teardown')] - except ValueError: - pass - else: + print(f"\n🔍 [DEBUG] Toutes les phases du test:", all_phases) + + # Debug 2: Vérifier la présence de call/teardown + has_call = 'call' in all_phases + has_teardown = 'teardown' in all_phases + print(f"🔍 [DEBUG] call présent: {has_call} | teardown présent: {has_teardown}") + + if has_call and has_teardown: + call_pos = all_phases.index('call') + teardown_pos = all_phases.index('teardown') + middle_phases = all_phases[call_pos+1 : teardown_pos] + + # Debug 3: Afficher le slicing exact + print(f"🔍 [DEBUG] Position call: {call_pos} | teardown: {teardown_pos}") + print(f"🔍 [DEBUG] Phases intermédiaires trouvées:", middle_phases) + if middle_phases: - f.write("- **Logs techniques:**\n
\n🛠️ Afficher les détails\n\n") + f.write("- **Logs techniques:**\n") + f.write("
\n🛠️ Afficher les détails\n\n") + for phase in middle_phases: - f.write(f"### {phase}\n```\n" + '\n'.join( - f"{k}: {v}" for k, v in test[phase].items() - ) + "\n```\n\n") + # Debug 4: Contenu de chaque phase + print(f"🔍 [DEBUG] Contenu de '{phase}':", test[phase].keys()) + + f.write(f"### {phase}\n```\n") + for field, value in test[phase].items(): + f.write(f"{field}: {value}\n") + f.write("```\n\n") + f.write("
\n") + else: + print("🔍 [DEBUG] Aucune phase entre call et teardown !") + else: + print("🔍 [DEBUG] call ou teardown manquant dans les phases !") f.write("
\n\n") f.write("\n\n") f.write("\n\n")