From da474e274ff614d6a282e37c3abd0b23bd2b2e96 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:45:26 +0900 Subject: [PATCH] chore: update tests --- tests/test_default_steam_paths.py | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test_default_steam_paths.py diff --git a/tests/test_default_steam_paths.py b/tests/test_default_steam_paths.py new file mode 100644 index 0000000..a7136f2 --- /dev/null +++ b/tests/test_default_steam_paths.py @@ -0,0 +1,43 @@ +import pytest +import tempfile + +from pathlib import Path +from typing import TYPE_CHECKING + +from dzgui.api.steam import get_steam_paths + +if TYPE_CHECKING: + from _pytest.monkeypatch import MonkeyPatch + + +def test_custom_xdg_path(monkeypatch: "MonkeyPatch") -> None: + tmp = tempfile.TemporaryDirectory(delete=False).name + custom_path = Path(tmp).joinpath("xdg_data_home") + monkeypatch.setenv("XDG_DATA_HOME", str(custom_path)) + + vdf_path = custom_path.joinpath("Steam/steamapps") + vdf_path.mkdir(parents=True, exist_ok=True) + vdf_path.joinpath("libraryfolders.vdf").touch() + + resolved_paths = get_steam_paths() + expect = custom_path.joinpath("Steam") + assert any(expect in el for el in resolved_paths) + + +def test_default_xdg_path() -> None: + resolved_paths = get_steam_paths() + expect = Path.home().joinpath(".local/share/Steam") + assert any(expect in el for el in resolved_paths) + + +def test_ubuntu_path() -> None: + resolved_paths = get_steam_paths() + expect = Path.home().joinpath(".steam/steam") + assert any(expect in el for el in resolved_paths) + + +@pytest.mark.flatpak +def test_flatpak_path() -> None: + resolved_paths = get_steam_paths() + expect = Path.home().joinpath(".var/app/com.valvesoftware.Steam/data/steam") + assert any(expect in el for el in resolved_paths)