Add version info. Add linter
All checks were successful
CI / test (push) Successful in 2m22s
Lint / test (push) Successful in 13s
Trivy / test (push) Successful in 21s

This commit is contained in:
Miguel Jacq 2025-11-13 16:26:35 +11:00
parent c191d9f35c
commit d338033333
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
7 changed files with 67 additions and 0 deletions

View file

@ -1,4 +1,6 @@
import pytest
import importlib.metadata
from pathlib import Path
import bouquin.main_window as mwmod
@ -906,9 +908,33 @@ def test_open_docs_and_bugs_show_warning_on_failure(
)
w._open_docs()
w._open_bugs()
assert seen["docs"] and seen["bugs"]
def test_open_version(qtbot, tmp_db_cfg, app, monkeypatch):
w = _make_main_window(tmp_db_cfg, app, monkeypatch)
qtbot.addWidget(w)
called = {"title": None, "text": None}
def fake_information(parent, title, text, *a, **k):
called["title"] = title
called["text"] = text
# Return value of QMessageBox.information is an int; 0 is fine.
return 0
# Patch whichever one you actually use in _open_version
monkeypatch.setattr(QMessageBox, "information", fake_information)
w._open_version()
assert called["title"] is not None
assert "version" in called["title"].lower()
version = importlib.metadata.version("bouquin")
assert version in called["text"]
# ---- Idle/lock/event filter helpers (1176, 1181-1187, 1193-1202, 1231-1233) ----