Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Fix file_operations tests

Reinier van der Leer7e7365eac294
diff --git a/autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py b/autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py
index b8e0f0550d..4db788bf28 100644
--- a/autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py
+++ b/autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py
@@ -33,5 +33,5 @@ class AgentFileManager:
def init_file_ops_log(file_logger_path: Path) -> Path:
if not file_logger_path.exists():
with file_logger_path.open(mode="w", encoding="utf-8") as f:
- f.write("File Operation Logger ")
+ f.write("")
return file_logger_path
diff --git a/autogpts/autogpt/tests/unit/test_file_operations.py b/autogpts/autogpt/tests/unit/test_file_operations.py
index a5929ab10d..3636ce8011 100644
--- a/autogpts/autogpt/tests/unit/test_file_operations.py
+++ b/autogpts/autogpt/tests/unit/test_file_operations.py
@@ -264,8 +264,16 @@ def test_append_to_file_uses_checksum_from_appended_file(
test_file_name: Path, agent: Agent
):
append_text = "This is appended text.\n"
- file_ops.append_to_file(test_file_name, append_text, agent=agent)
- file_ops.append_to_file(test_file_name, append_text, agent=agent)
+ file_ops.append_to_file(
+ agent.workspace.get_path(test_file_name),
+ append_text,
+ agent=agent,
+ )
+ file_ops.append_to_file(
+ agent.workspace.get_path(test_file_name),
+ append_text,
+ agent=agent,
+ )
with open(agent.file_manager.file_ops_log_path, "r", encoding="utf-8") as f:
log_contents = f.read()