Skip to content

Commit

Permalink
Add test for appinfo.vdf V29
Browse files Browse the repository at this point in the history
Serialization support for appinfo.vdf V29 does not exist in the `vdf`
library or Protontricks test tooling itself. Since implementing proper
support involves more work than it's probably worth, just implement a
simple test using a hand-written file for the time being.
  • Loading branch information
Matoking committed Sep 15, 2024
1 parent d28ffb8 commit 048fd80
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Binary file added tests/data/appinfo_v29.vdf
Binary file not shown.
21 changes: 20 additions & 1 deletion tests/test_steam.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
find_steam_installations, find_steam_path,
get_custom_compat_tool_installations,
get_custom_windows_shortcuts, get_steam_apps,
get_steam_lib_paths)
get_steam_lib_paths, iter_appinfo_sections)


class TestSteamApp:
Expand Down Expand Up @@ -1094,6 +1094,25 @@ def test_get_custom_windows_shortcuts_no_prefix(
)


def test_parse_appinfo_v29():
"""
Test parsing an appinfo.vdf V29 file and retrieving the app sections
correctly.
Creating proper appinfo.vdf V29 files on demand for test fixtures
involves plenty of work and is probably a rare use case outside creating
test files, so just use a hardcoded test file for the time being.
"""
app_sections = list(
iter_appinfo_sections(Path("./tests/data/appinfo_v29.vdf").resolve())
)

assert len(app_sections) == 2

assert app_sections[0]["appinfo"]["appid"] == 5
assert app_sections[1]["appinfo"]["appid"] == 10


def test_get_steamapps_subdirs(steam_dir, steam_library_factory):
"""
Retrieve Steam library directory containing multiple 'steamapps'
Expand Down

0 comments on commit 048fd80

Please sign in to comment.