chore: typehint tests

This commit is contained in:
aclist committed 2026-11-12 05:10:02 +09:00
1 parent a5374d1f1a
commit e29433b388
23 files changed
+170 -93

No files matched your search

+11 -7
View File
@@ -1,6 +1,8 @@
import configparser
import pytest
from pathlib import Path
from dzgui.const.constants import FLATPAK_APPID, GTK_APP_ID, TMP_PATH
from dzgui.config.xdg import get_xdg_paths
from dzgui.util.flatpak import apply_overrides
@@ -13,17 +15,17 @@ pytestmark = pytest.mark.flatpak
@pytest.fixture
def xdg_paths() -> dict[str, str]:
def xdg_paths() -> dict[str, Path]:
return get_xdg_paths()
@pytest.fixture
def override(xdg_paths) -> None:
def override(xdg_paths: dict[str, Path]) -> None:
apply_overrides(xdg_paths)
@pytest.fixture
def config(xdg_paths) -> configparser.ConfigParser:
def config(xdg_paths: dict[str, Path]) -> configparser.ConfigParser:
conf_path = xdg_paths["XDG_DATA_HOME"].parent.joinpath(
f"flatpak/overrides/{FLATPAK_APPID}"
)
@@ -32,14 +34,16 @@ def config(xdg_paths) -> configparser.ConfigParser:
return config
def test_session_bus(override, config) -> None:
def test_session_bus(override: None, config: configparser.ConfigParser) -> None:
bus = config[BUS_KEY][GTK_APP_ID]
assert bus == "own"
def test_paths(override, xdg_paths, config) -> None:
expect: list[str] = []
expect.append(TMP_PATH)
def test_paths(
override: None, xdg_paths: dict[str, Path], config: configparser.ConfigParser
) -> None:
expect: list[Path] = []
expect.append(Path(TMP_PATH))
expect.extend([*xdg_paths.values()])
paths = config[PATHS_KEY][PATHS_SUBKEY].split(";")
assert all(str(path) in paths for path in expect)