From 427164b0bf258ddac6f23272f4886c4ee42ddc69 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 9 Aug 2024 18:54:32 -0400 Subject: [PATCH] fix: Use samefile check in test_cmd_read --- tests/basic/test_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index a7a895c0b..d5020f64a 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -745,13 +745,13 @@ class TestCommands(TestCase): commands.cmd_read(str(test_file)) # Check if the file was added to abs_read_only_fnames - self.assertIn(str(test_file.resolve()), coder.abs_read_only_fnames) + self.assertTrue(any(os.path.samefile(str(test_file.resolve()), fname) for fname in coder.abs_read_only_fnames)) # Test dropping the read-only file commands.cmd_drop(str(test_file)) # Check if the file was removed from abs_read_only_fnames - self.assertNotIn(str(test_file.resolve()), coder.abs_read_only_fnames) + self.assertFalse(any(os.path.samefile(str(test_file.resolve()), fname) for fname in coder.abs_read_only_fnames)) def test_cmd_read_with_external_file(self): with tempfile.NamedTemporaryFile(mode="w", delete=False) as external_file: