From 7e7365eac294504096718e1e1eb582d76845cc02 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Tue, 17 Oct 2023 17:07:15 -0700 Subject: [PATCH] Fix file_operations tests --- .../autogpt/agents/utils/agent_file_manager.py | 2 +- autogpts/autogpt/tests/unit/test_file_operations.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py b/autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py index b8e0f055..4db788bf 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 a5929ab1..3636ce80 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()