Skip to content

Commit fa99111

Browse files
cursoragentPuritanWizard
andcommitted
test(tslpatcher): cover case-aware ini path resolution
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
1 parent 640f8ba commit fa99111

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Libraries/PyKotor/tests/tslpatcher/test_reader.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,5 +1850,25 @@ def _setupIniAndConfig(self, ini_text: str) -> PatcherConfig:
18501850
# endregion
18511851

18521852

1853+
class TestConfigReaderFromFilepath(unittest.TestCase):
1854+
@unittest.skipIf(
1855+
sys.platform == "win32",
1856+
"Case mismatch semantics differ on Windows filesystems.",
1857+
)
1858+
def test_from_filepath_resolves_case_mismatched_mod_directory(self):
1859+
with tempfile.TemporaryDirectory() as tmp:
1860+
mod_root = Path(tmp) / "MyMod"
1861+
mod_root.mkdir()
1862+
ini_path = mod_root / "changes.ini"
1863+
ini_path.write_text(
1864+
"[Settings]\nLookupGameFolder=0\nLookupGameNumber=1\n",
1865+
encoding="utf-8",
1866+
)
1867+
1868+
reader = ConfigReader.from_filepath(mod_root.parent / "mymod" / "CHANGES.INI")
1869+
self.assertTrue(reader.mod_path.is_dir())
1870+
self.assertEqual(reader.mod_path.name, "MyMod")
1871+
1872+
18531873
if __name__ == "__main__":
18541874
unittest.main()

0 commit comments

Comments
 (0)