From 04b6b2ee4a040359a5b9047ee5b7a2204e050eba Mon Sep 17 00:00:00 2001 From: thiefyzheng Date: Tue, 24 Nov 2026 23:56:11 +0000 Subject: [PATCH] tests: assert the PermissionError filename as OSError renders it (TEST-WIN-PERMERR-REPR) Three unreadable-directory tests compared the plain path against the captured stderr, but the tools print str(exc), whose .filename is rendered with repr(): quoted, backslashes doubled. On Windows each file failed that one assertion; on Linux the path never contains backslashes so they passed. The assertions now compare repr(blocked), the exact rendering under test. The finding is GTAVIB4GTAVI's (coordination issue #14, 23:34:10Z). AI-assisted. --- tests/test_bink_names.py | 2 +- tests/test_opus_tags.py | 2 +- tests/test_world_names.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_bink_names.py b/tests/test_bink_names.py index 62790e08f1..128f72ecef 100644 --- a/tests/test_bink_names.py +++ b/tests/test_bink_names.py @@ -337,7 +337,7 @@ 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()) + 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..9c99766882 100644 --- a/tests/test_opus_tags.py +++ b/tests/test_opus_tags.py @@ -334,7 +334,7 @@ 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()) + 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..a8b0e6c536 100644 --- a/tests/test_world_names.py +++ b/tests/test_world_names.py @@ -46,7 +46,7 @@ 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()) + self.assertIn(repr(blocked), err.getvalue()) with open(output, "rb") as f: self.assertEqual(f.read(), b"existing dictionary")