feat(gui): câblage upload diagnostics en fin de run (E3)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 10:44:02 +02:00
parent 8eb8cf9999
commit 8f9107a27f
3 changed files with 76 additions and 0 deletions

View File

@@ -108,3 +108,29 @@ def test_flush_spool_sends_and_clears(tmp_path):
sent = diagnostics.flush_spool(spool, diagnostics.DiagnosticsClient(
"https://app.aivanov.eu", session=_FakeSession(status_code=200)))
assert sent == 2 and not spool.exists()
def test_tab_send_diagnostics_calls_reporter():
import threading
from gui_v6.tabs.tab_usage import UsageTab
tab = object.__new__(UsageTab) # pas de Tk : on teste juste le helper
seen = {}
done = threading.Event()
def reporter(summary):
seen["summary"] = summary
done.set()
tab._diag_reporter = reporter
tab._send_diagnostics(SimpleNamespace(documents=[], failed=0))
assert done.wait(timeout=2.0)
assert seen["summary"] is not None
def test_tab_send_diagnostics_noop_without_reporter():
from gui_v6.tabs.tab_usage import UsageTab
tab = object.__new__(UsageTab)
tab._diag_reporter = None
tab._send_diagnostics(SimpleNamespace(documents=[])) # ne lève pas