chore: cherry pick changes from test-typehints branch

This commit is contained in:
aclist committed 2026-11-19 06:45:14 +09:00
1 parent 5853e15b8e
commit 8aca23cf76
5 files changed
+57 -14

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import pytest
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING
from dzgui.config.xdg import get_xdg_paths
if TYPE_CHECKING:
from _pytest.monkeypatch import MonkeyPatch
@pytest.mark.parametrize("env", ["SNAP_REAL_HOME", "HOME"])
def test_sandbox_home_resolution(monkeypatch: "MonkeyPatch", env: str) -> None:
with tempfile.NamedTemporaryFile(delete=False) as f:
monkeypatch.setenv(env, f.name)
paths = get_xdg_paths()
assert paths["XDG_CONFIG_HOME"] == Path(f.name).joinpath(".config/dzgui")
def test_home_fallback() -> None:
paths = get_xdg_paths()
assert paths["XDG_CONFIG_HOME"] == Path.home().joinpath(".config/dzgui")