From 9beee15b68bc5afb405a78791aab82ea497a6a3c Mon Sep 17 00:00:00 2001 From: icecreammule277-dot <360389640+icecreammule277-dot@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:33:39 -0500 Subject: [PATCH] tests: expect the unreadable path as OSError prints it (bink_names, opus_tags, world_names) Each test makes the tree walk report an unreadable folder and asserts the folder's path appears in the tool's error message. The message embeds str(OSError), which prints the filename with repr(), so on Windows every backslash is doubled and assertIn(path, message) misses. Expect repr(path), which is the text OSError produces; on POSIX the two are identical. Co-Authored-By: Claude Sonnet 5.5 --- tests/test_bink_names.py | 3 ++- tests/test_opus_tags.py | 3 ++- tests/test_world_names.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_bink_names.py b/tests/test_bink_names.py index 62790e08f1..5a003f3580 100644 --- a/tests/test_bink_names.py +++ b/tests/test_bink_names.py @@ -337,7 +337,8 @@ def walk(path, onerror=None): with mock.patch.object(names_mod.os, "walk", walk), \ contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()) as err: self.assertEqual(names_mod.main([source, "--mount", mount, "--out", report]), 1) - self.assertIn(blocked, err.getvalue()) + # str(OSError) prints the filename with repr(): on Windows every backslash in the path is doubled. + self.assertIn(repr(blocked), err.getvalue()) with open(report, "rb") as f: self.assertEqual(f.read(), b"previous report") diff --git a/tests/test_opus_tags.py b/tests/test_opus_tags.py index 5ee89c8a6e..06926bd10e 100644 --- a/tests/test_opus_tags.py +++ b/tests/test_opus_tags.py @@ -334,7 +334,8 @@ def walk(path, onerror=None): with mock.patch.object(T.os, "walk", walk), contextlib.redirect_stderr(io.StringIO()) as err: self.assertEqual(T.main([root, "--names", names, "--dry-run"]), 2) - self.assertIn(blocked, err.getvalue()) + # str(OSError) prints the filename with repr(): on Windows every backslash in the path is doubled. + self.assertIn(repr(blocked), err.getvalue()) def test_cli(self): r = subprocess.run([sys.executable, "-I", TOOL, self.opus, "--names", self.names, "--source", "story", diff --git a/tests/test_world_names.py b/tests/test_world_names.py index ceb2dc92b3..3944be771c 100644 --- a/tests/test_world_names.py +++ b/tests/test_world_names.py @@ -46,7 +46,8 @@ def walk(root, onerror=None): with mock.patch.object(WN.os, "walk", walk), contextlib.redirect_stderr(io.StringIO()) as err, \ contextlib.redirect_stdout(io.StringIO()): self.assertEqual(WN.main(["build", "--manifest", manifests, "--names", names, "--out", output]), 1) - self.assertIn(blocked, err.getvalue()) + # str(OSError) prints the filename with repr(): on Windows every backslash in the path is doubled. + self.assertIn(repr(blocked), err.getvalue()) with open(output, "rb") as f: self.assertEqual(f.read(), b"existing dictionary")