mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-28 10:26:32 +02:00
add agent subscription
This commit is contained in:
parent
6f345002c4
commit
dfc6e13ac3
3 changed files with 217 additions and 2 deletions
|
|
@ -6,14 +6,15 @@
|
|||
@File : conftest.py
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from metagpt.logs import logger
|
||||
from metagpt.provider.openai_api import OpenAIGPTAPI as GPTAPI
|
||||
import asyncio
|
||||
import re
|
||||
|
||||
|
||||
class Context:
|
||||
|
|
@ -68,3 +69,14 @@ def proxy():
|
|||
|
||||
server = asyncio.get_event_loop().run_until_complete(asyncio.start_server(handle_client, "127.0.0.1", 0))
|
||||
return "http://{}:{}".format(*server.sockets[0].getsockname())
|
||||
|
||||
|
||||
# see https://github.com/Delgan/loguru/issues/59#issuecomment-466591978
|
||||
@pytest.fixture
|
||||
def loguru_caplog(caplog):
|
||||
class PropogateHandler(logging.Handler):
|
||||
def emit(self, record):
|
||||
logging.getLogger(record.name).handle(record)
|
||||
|
||||
logger.add(PropogateHandler(), format="{message}")
|
||||
yield caplog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue