Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

Update: improve the unit testing of tutorial assistants and OCR assistants.

Stitch-z25b58f22ca09
diff --git a/tests/metagpt/roles/test_tutorial_assistant.py b/tests/metagpt/roles/test_tutorial_assistant.py
index f019c07d4..4455e1bf6 100644
--- a/tests/metagpt/roles/test_tutorial_assistant.py
+++ b/tests/metagpt/roles/test_tutorial_assistant.py
@@ -5,19 +5,27 @@
@Author : Stitch-z
@File : test_tutorial_assistant.py
"""
+import shutil
import aiofiles
import pytest
+from metagpt.const import TUTORIAL_PATH
from metagpt.roles.tutorial_assistant import TutorialAssistant
@pytest.mark.asyncio
@pytest.mark.parametrize(("language", "topic"), [("Chinese", "Write a tutorial about pip")])
async def test_tutorial_assistant(language: str, topic: str):
+ shutil.rmtree(path=TUTORIAL_PATH, ignore_errors=True)
+
role = TutorialAssistant(language=language)
msg = await role.run(topic)
+ assert TUTORIAL_PATH.exists()
filename = msg.content
async with aiofiles.open(filename, mode="r", encoding="utf-8") as reader:
content = await reader.read()
- assert content
+ assert "pip" in content
+
+if __name__ == "__main__":
+ pytest.main([__file__, "-s"])