Improve crash diagnostics and isolate watcher-thread failures
Main-thread unhandled exceptions now show the traceback and log path; worker-thread exceptions log without touching Qt widgets. The download watcher catches its own loop failures and reports that it stopped instead of surfacing a blank error dialog. Adds a regression test for the watcher failure path. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Code
parent
ffe95020bc
commit
47f520fb8f
@@ -58,6 +58,19 @@ def test_firefox_download_preference_is_watched(tmp_path, monkeypatch):
|
||||
assert download.resolve() in [path.resolve() for path in roots]
|
||||
|
||||
|
||||
def test_watcher_stops_cleanly_instead_of_raising(monkeypatch, qapp):
|
||||
messages: list[str] = []
|
||||
watcher = realtime.DownloadWatcher(interval=0.1)
|
||||
watcher.watch_status.connect(messages.append)
|
||||
monkeypatch.setattr(realtime, "browser_download_roots", lambda extra: (_ for _ in ()).throw(
|
||||
RuntimeError("simulated watcher failure")))
|
||||
watcher.start()
|
||||
assert watcher.wait(3000)
|
||||
qapp.processEvents()
|
||||
assert not watcher.isRunning()
|
||||
assert "stopped" in " ".join(messages).lower()
|
||||
|
||||
|
||||
def test_copy_for_scan_preserves_bytes(tmp_path):
|
||||
source = tmp_path / "download.exe"
|
||||
source.write_bytes(b"sample bytes")
|
||||
|
||||
Reference in New Issue
Block a user