From 02c0c34d55ed6ff5c8517b81db9b528afcfd44a8 Mon Sep 17 00:00:00 2001 From: Luke Horwell Date: Sat, 1 Jun 2024 16:51:09 +0100 Subject: [PATCH] Tests: Fix error due to writing meta file We're testing the function outside of a game directory, so ignore the meta file as we're not writing any files on disk. --- patches.py | 5 +++-- tests/test_patches.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/patches.py b/patches.py index 3a88698..c42a664 100755 --- a/patches.py +++ b/patches.py @@ -182,7 +182,7 @@ def _cb_save_progress_updated(text: str, value: int, total: int): file.write_meta_file() -def upscale_fontstyle_ini(file: GameFile): +def upscale_fontstyle_ini(file: GameFile, write_meta_file=True): """ Parses FontStyle.ini (from the Fonts folder) and writes a new one with new font sizes. @@ -212,4 +212,5 @@ def upscale_fontstyle_ini(file: GameFile): f.writelines(output) file.patched = True - file.write_meta_file() + if write_meta_file: + file.write_meta_file() diff --git a/tests/test_patches.py b/tests/test_patches.py index b44802c..248a6b4 100644 --- a/tests/test_patches.py +++ b/tests/test_patches.py @@ -55,7 +55,7 @@ def test_fontstyle_ini(self): dummy_file = GameFile(tmp_path) dummy_file.backup_path = self._get_test_file_path("FontStyle-A.ini") - patches.upscale_fontstyle_ini(dummy_file) + patches.upscale_fontstyle_ini(dummy_file, write_meta_file=False) # Compare output with expected output expected = self._get_test_file_data("FontStyle-B.ini")