🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
update asyncio.sleep to make it async
better6290f2d96a7e2ad
diff --git a/tests/metagpt/serialize_deserialize/test_serdeser_base.py b/tests/metagpt/serialize_deserialize/test_serdeser_base.pyindex 74f9fea87..298c13823 100644--- a/tests/metagpt/serialize_deserialize/test_serdeser_base.py+++ b/tests/metagpt/serialize_deserialize/test_serdeser_base.py@@ -4,6 +4,7 @@from pydantic import BaseModel, Fieldfrom pathlib import Path+import asynciofrom metagpt.actions.action import Actionfrom metagpt.roles.role import Role, RoleReactMode@@ -24,6 +25,7 @@ class ActionPass(Action):name: str = Field(default="ActionPass")async def run(self, messages: list["Message"]) -> ActionOutput:+ await asyncio.sleep(5) # sleep to make other roles can watch the executed Messageoutput_mapping = {"result": (str, ...)}@@ -37,6 +39,7 @@ class ActionOK(Action):name: str = Field(default="ActionOK")async def run(self, messages: list["Message"]) -> str:+ await asyncio.sleep(5)return "ok"@@ -55,14 +58,10 @@ class RoleA(Role):constraints: str = "RoleA's constraints"def __init__(self, **kwargs):- # super(RoleA, self).__init__(**kwargs)- super().__init__(**kwargs)+ super(RoleA, self).__init__(**kwargs)self._init_actions([ActionPass])self._watch([BossRequirement])- async def run(self, message: "Message" = None):- await super(RoleA, self).run(message)-class RoleB(Role):name: str = Field(default="RoleB")@@ -71,15 +70,11 @@ class RoleB(Role):constraints: str = "RoleB's constraints"def __init__(self, **kwargs):- # super(RoleB, self).__init__(**kwargs)- super().__init__(**kwargs)+ super(RoleB, self).__init__(**kwargs)self._init_actions([ActionOK, ActionRaise])self._watch([ActionPass])self._rc.react_mode = RoleReactMode.BY_ORDER- async def run(self, message: "Message" = None):- await super(RoleB, self).run(message)-class RoleC(Role):name: str = Field(default="RoleC")@@ -92,6 +87,3 @@ class RoleC(Role):self._init_actions([ActionOK, ActionRaise])self._watch([BossRequirement])self._rc.react_mode = RoleReactMode.BY_ORDER-- async def run(self, message: "Message" = None):- await super(RoleC, self).run(message)