Skip to content

Commit 43d07de

Browse files
author
莘权 马
committed
feat: Replace the actual root directory name of the project codes with a fake one in the WriteTest prompt.
1 parent c966138 commit 43d07de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

metagpt/actions/write_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from typing import Optional
1212

1313
from metagpt.actions.action import Action
14-
from metagpt.config import CONFIG
1514
from metagpt.const import TEST_CODES_FILE_REPO
1615
from metagpt.logs import logger
1716
from metagpt.schema import Document, TestingContext
@@ -60,11 +59,12 @@ async def run(self, *args, **kwargs) -> TestingContext:
6059
self.context.test_doc = Document(
6160
filename="test_" + self.context.code_doc.filename, root_path=TEST_CODES_FILE_REPO
6261
)
62+
fake_root = "/data"
6363
prompt = PROMPT_TEMPLATE.format(
6464
code_to_test=self.context.code_doc.content,
6565
test_file_name=self.context.test_doc.filename,
66-
source_file_path=self.context.code_doc.root_relative_path,
67-
workspace=CONFIG.git_repo.workdir,
66+
source_file_path=fake_root + "/" + self.context.code_doc.root_relative_path,
67+
workspace=fake_root,
6868
)
6969
self.context.test_doc.content = await self.write_code(prompt)
7070
return self.context

0 commit comments

Comments
 (0)