diff --git a/tests/metagpt/actions/test_design_api_an.py b/tests/metagpt/actions/test_design_api_an.py index e50288640..32d6c11b0 100644 --- a/tests/metagpt/actions/test_design_api_an.py +++ b/tests/metagpt/actions/test_design_api_an.py @@ -92,7 +92,9 @@ CONTEXT = """ """ -llm = OpenAIGPTAPI() +@pytest.fixture() +def llm(): + return OpenAIGPTAPI() @pytest.mark.asyncio diff --git a/tests/metagpt/actions/test_project_management_an.py b/tests/metagpt/actions/test_project_management_an.py index 86c5e3685..116dffe83 100644 --- a/tests/metagpt/actions/test_project_management_an.py +++ b/tests/metagpt/actions/test_project_management_an.py @@ -131,11 +131,14 @@ CONTEXT = """ } """ -llm = OpenAIGPTAPI() + +@pytest.fixture() +def llm(): + return OpenAIGPTAPI() @pytest.mark.asyncio -async def test_project_management_an(): +async def test_project_management_an(llm): node = await REFINED_PM_NODES.fill(CONTEXT, llm) assert node.instruct_content assert "Refined Logic Analysis" in node.instruct_content.json(ensure_ascii=False) diff --git a/tests/metagpt/actions/test_write_code_guideline_an.py b/tests/metagpt/actions/test_write_code_guideline_an.py index c9fb78e0e..602145ce8 100644 --- a/tests/metagpt/actions/test_write_code_guideline_an.py +++ b/tests/metagpt/actions/test_write_code_guideline_an.py @@ -7,7 +7,7 @@ """ import pytest -from metagpt.actions import WriteCode +from metagpt.actions.write_code import WriteCode from metagpt.actions.write_code_guideline_an import ( CODE_GUIDELINE_CONTEXT, CODE_GUIDELINE_SCRIPT_EXAMPLE, @@ -15,7 +15,6 @@ from metagpt.actions.write_code_guideline_an import ( REFINED_CODE_TEMPLATE, WriteCodeGuideline, ) -from metagpt.provider import OpenAIGPTAPI REQUIREMENT_EXAMPLE = """Add subtraction, multiplication and division operations to the calculator. The current calculator can only perform basic addition operations, and it is necessary to introduce subtraction, multiplication, division operation into the calculator @@ -80,8 +79,6 @@ INCREMENTAL_CHANGE_EXAMPLE = """ } """ -llm = OpenAIGPTAPI() - @pytest.mark.asyncio async def test_write_code_guideline_an(): diff --git a/tests/metagpt/actions/test_write_prd_an.py b/tests/metagpt/actions/test_write_prd_an.py index a7424bf49..ef0dd2eff 100644 --- a/tests/metagpt/actions/test_write_prd_an.py +++ b/tests/metagpt/actions/test_write_prd_an.py @@ -75,11 +75,14 @@ Please change the game's score target from 2048 to 4096, and change the interfac - """ -llm = OpenAIGPTAPI() + +@pytest.fixture() +def llm(): + return OpenAIGPTAPI() @pytest.mark.asyncio -async def test_write_prd_an(): +async def test_write_prd_an(llm): node = await REFINE_PRD_NODE.fill(CONTEXT, llm) assert node.instruct_content assert "Refined Requirement Pool" in node.instruct_content.json(ensure_ascii=False)