From 1a0ac1838551e7fbf98a8ccd837f6f984c79896a Mon Sep 17 00:00:00 2001 From: Thanatos Date: Mon, 8 Jan 2024 16:40:24 +0100 Subject: [PATCH] Address review for test_pkg.py --- tests/formats/test_pkg.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/formats/test_pkg.py b/tests/formats/test_pkg.py index 0f3f6c3a..73ae21db 100644 --- a/tests/formats/test_pkg.py +++ b/tests/formats/test_pkg.py @@ -1,19 +1,31 @@ +import pytest from construct import Container, ListContainer from tests.test_lib import parse_and_build_compare +from mercury_engine_data_structures import dread_data, samus_returns_data from mercury_engine_data_structures.formats.pkg import Pkg from mercury_engine_data_structures.game_check import Game _EMPTY_DREAD_PKG = (b'\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +all_dread_pkg = [name for name in dread_data.all_name_to_asset_id().keys() + if name.endswith(".pkg")] -def test_compare_dread(dread_path): - pkg_files = [f for f in dread_path.rglob("*.pkg")] - for f in pkg_files: - parse_and_build_compare( - Pkg.construct_class(Game.DREAD), Game.DREAD, dread_path.joinpath(f) - ) +all_sr_pkg = [name for name in samus_returns_data.all_name_to_asset_id().keys() + if name.endswith(".pkg")] +@pytest.mark.parametrize("pkg_path", all_dread_pkg) +def test_compare_dread(dread_path, pkg_path): + parse_and_build_compare( + Pkg.construct_class(Game.DREAD), Game.DREAD, dread_path.joinpath(pkg_path) + ) + +@pytest.mark.skip("Rebuilding vanilla pkg files is currently not supported for SR") +@pytest.mark.parametrize("pkg_path", all_sr_pkg) +def test_compare_sr(samus_returns_path, pkg_path): + parse_and_build_compare( + Pkg.construct_class(Game.SAMUS_RETURNS), Game.SAMUS_RETURNS, samus_returns_path.joinpath(pkg_path) + ) def test_build_empty_pkg(): pkg = Pkg(Container(files=ListContainer()), Game.DREAD)