Skip to content

Commit

Permalink
Tests: Fix error due to writing meta file
Browse files Browse the repository at this point in the history
We're testing the function outside of a game directory, so ignore the
meta file as we're not writing any files on disk.
  • Loading branch information
lah7 committed Jun 1, 2024
1 parent 2e4f502 commit 02c0c34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 02c0c34

Please sign in to comment.