diff --git a/metagpt/actions/write_test.py b/metagpt/actions/write_test.py index 0166f5417..96486311f 100644 --- a/metagpt/actions/write_test.py +++ b/metagpt/actions/write_test.py @@ -11,7 +11,6 @@ from typing import Optional from metagpt.actions.action import Action -from metagpt.config import CONFIG from metagpt.const import TEST_CODES_FILE_REPO from metagpt.logs import logger from metagpt.schema import Document, TestingContext @@ -60,11 +59,12 @@ class WriteTest(Action): self.context.test_doc = Document( filename="test_" + self.context.code_doc.filename, root_path=TEST_CODES_FILE_REPO ) + fake_root = "/data" prompt = PROMPT_TEMPLATE.format( code_to_test=self.context.code_doc.content, test_file_name=self.context.test_doc.filename, - source_file_path=self.context.code_doc.root_relative_path, - workspace=CONFIG.git_repo.workdir, + source_file_path=fake_root + "/" + self.context.code_doc.root_relative_path, + workspace=fake_root, ) self.context.test_doc.content = await self.write_code(prompt) return self.context