From 68a78e4882e6765698e874d689e2ecf0fde03823 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 23 Aug 2024 07:00:45 -0700 Subject: [PATCH] fix: Use platform-independent path for read-only file test --- tests/basic/test_commands.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index c7fbc0cba..b6cee63f6 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -898,8 +898,9 @@ class TestCommands(TestCase): test_file.write_text("Test content") try: - # Test the /read-only command with a path containing a tilde - commands.cmd_read_only("~/test_read_only_file.txt") + # Test the /read-only command with a path in the user's home directory + relative_path = os.path.join("~", "test_read_only_file.txt") + commands.cmd_read_only(relative_path) # Check if the file was added to abs_read_only_fnames self.assertTrue( @@ -910,7 +911,7 @@ class TestCommands(TestCase): ) # Test dropping the read-only file - commands.cmd_drop("~/test_read_only_file.txt") + commands.cmd_drop(relative_path) # Check if the file was removed from abs_read_only_fnames self.assertEqual(len(coder.abs_read_only_fnames), 0)