MCPcopy
hub / github.com/Aider-AI/aider / test_cmd_read_only

Method test_cmd_read_only

tests/basic/test_commands.py:1381–1411  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1379 self.assertNotIn(fname3, str(coder.abs_fnames))
1380
1381 def test_cmd_read_only(self):
1382 with GitTemporaryDirectory():
1383 io = InputOutput(pretty=False, fancy_input=False, yes=False)
1384 coder = Coder.create(self.GPT35, None, io)
1385 commands = Commands(io, coder)
1386
1387 # Create a test file
1388 test_file = Path("test_read.txt")
1389 test_file.write_text("Test content")
1390
1391 # Test the /read command
1392 commands.cmd_read_only(str(test_file))
1393
1394 # Check if the file was added to abs_read_only_fnames
1395 self.assertTrue(
1396 any(
1397 os.path.samefile(str(test_file.resolve()), fname)
1398 for fname in coder.abs_read_only_fnames
1399 )
1400 )
1401
1402 # Test dropping the read-only file
1403 commands.cmd_drop(str(test_file))
1404
1405 # Check if the file was removed from abs_read_only_fnames
1406 self.assertFalse(
1407 any(
1408 os.path.samefile(str(test_file.resolve()), fname)
1409 for fname in coder.abs_read_only_fnames
1410 )
1411 )
1412
1413 def test_cmd_read_only_from_working_dir(self):
1414 with GitTemporaryDirectory() as repo_dir:

Callers

nothing calls this directly

Calls 7

cmd_read_onlyMethod · 0.95
cmd_dropMethod · 0.95
InputOutputClass · 0.90
CommandsClass · 0.90
createMethod · 0.80
write_textMethod · 0.80

Tested by

no test coverage detected