mirror of
https://github.com/aclist/dztui.git
synced 2026-11-19 00:02:04 +01:00
chore: cherry pick changes from test-typehints branch
This commit is contained in:
1 parent
5853e15b8e
commit
663e57b8cd
4 files changed
+31
-8
No files matched your search
@@ -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")
|
||||
Reference in new issue
Block a user