mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 11:47:17 +02:00
Compare commits
No commits in common. "d8239f1c34b42d1e33497173d9c39093b08b1c09" and "e9d4054e76d52abd0e67e4dbd1f0ea88535f208b" have entirely different histories.
d8239f1c34
...
e9d4054e76
@ -76,7 +76,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
line-length = 88
|
line-length = 88
|
||||||
indent-width = 4
|
indent-width = 4
|
||||||
extend-exclude = ["*lib/a2s"]
|
extend-exclude = ["*lib/a2s"]
|
||||||
lint.unfixable = ["F401", "I001"]
|
lint.unfixable = ["F401"]
|
||||||
|
|
||||||
[tool.ruff.format]
|
[tool.ruff.format]
|
||||||
quote-style = "double"
|
quote-style = "double"
|
||||||
|
|||||||
@ -12,7 +12,6 @@ This file includes the combined licenses to the following components:
|
|||||||
- psutil
|
- psutil
|
||||||
- PyGObject
|
- PyGObject
|
||||||
- python-a2s
|
- python-a2s
|
||||||
- vdf
|
|
||||||
|
|
||||||
When shipped as a binary installer, these components are collectively bundled
|
When shipped as a binary installer, these components are collectively bundled
|
||||||
as a turnkey application and used to run the DZGUI utility.\n\n
|
as a turnkey application and used to run the DZGUI utility.\n\n
|
||||||
|
|||||||
@ -1,22 +1,21 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
import dzgui.api.pefile as PeFile
|
import dzgui.api.pefile as PeFile
|
||||||
from dzgui.api.steam import (
|
from dzgui.api.steam import VDFLoadError, AppNotInstalledError, AppMovedError, get_app_path
|
||||||
VDFLoadError,
|
|
||||||
AppNotInstalledError,
|
|
||||||
AppMovedError,
|
|
||||||
get_app_path
|
|
||||||
)
|
|
||||||
|
|
||||||
from dzgui.config.query import get_config
|
from dzgui.config.query import get_config
|
||||||
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
||||||
from dzgui.const.constants import APPID_DAYZ, LIBRARYFOLDERS_PATH
|
from dzgui.const.constants import APPID_DAYZ
|
||||||
|
|
||||||
from tests.fixtures import fixture_path
|
from tests.fixtures import fixture_path
|
||||||
|
|
||||||
pytestmark = pytest.mark.apitest
|
pytestmark = pytest.mark.pefile
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def second_drive():
|
||||||
|
return fixture_path("in_library_on_second_drive.vdf")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -27,8 +26,6 @@ def default_steam_path():
|
|||||||
return conf["default_steam_path"]
|
return conf["default_steam_path"]
|
||||||
|
|
||||||
|
|
||||||
# TODO: split into separate test file
|
|
||||||
# FIXME: use fixtures
|
|
||||||
def test_pefile_length(default_steam_path):
|
def test_pefile_length(default_steam_path):
|
||||||
try:
|
try:
|
||||||
pe_file_path = PeFile.get_pefile_path(Path(default_steam_path), APPID_DAYZ)
|
pe_file_path = PeFile.get_pefile_path(Path(default_steam_path), APPID_DAYZ)
|
||||||
@ -55,26 +52,15 @@ def test_invalid_pefile_path():
|
|||||||
("malformed.vdf", VDFLoadError),
|
("malformed.vdf", VDFLoadError),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_not_in_library(monkeypatch, fixture, exception):
|
def test_not_in_library(fixture, exception):
|
||||||
import dzgui.api.steam as steam
|
fixture = fixture_path(fixture)
|
||||||
monkeypatch.setattr(steam, "LIBRARYFOLDERS_PATH", fixture)
|
|
||||||
|
|
||||||
folder_path = Path(fixture_path("api"))
|
|
||||||
with pytest.raises(exception):
|
with pytest.raises(exception):
|
||||||
try:
|
try:
|
||||||
get_app_path(folder_path, APPID_DAYZ)
|
get_app_path(fixture, APPID_DAYZ)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
def test_on_second_drive(second_drive):
|
||||||
def second_drive():
|
path = get_app_path(second_drive, APPID_DAYZ)
|
||||||
return "in_library_on_second_drive.vdf"
|
|
||||||
|
|
||||||
|
|
||||||
def test_on_second_drive(monkeypatch, second_drive):
|
|
||||||
import dzgui.api.steam as steam
|
|
||||||
monkeypatch.setattr(steam, "LIBRARYFOLDERS_PATH", second_drive)
|
|
||||||
folder_path = Path(fixture_path("api"))
|
|
||||||
path = get_app_path(folder_path, APPID_DAYZ)
|
|
||||||
assert path == Path("/tmp")
|
assert path == Path("/tmp")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user