mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-03 12:52:37 +02:00
init project
This commit is contained in:
commit
c871144507
204 changed files with 7220 additions and 0 deletions
39
tests/conftest.py
Normal file
39
tests/conftest.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@Time : 2023/5/1 12:10
|
||||
@Author : alexanderwu
|
||||
@File : conftest.py
|
||||
"""
|
||||
|
||||
from unittest.mock import Mock
|
||||
import pytest
|
||||
from metagpt.logs import logger
|
||||
|
||||
from metagpt.provider.openai_api import OpenAIGPTAPI as GPTAPI
|
||||
|
||||
|
||||
class Context:
|
||||
def __init__(self):
|
||||
self._llm_ui = None
|
||||
self._llm_api = GPTAPI()
|
||||
|
||||
@property
|
||||
def llm_api(self):
|
||||
return self._llm_api
|
||||
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def llm_api():
|
||||
logger.info("Setting up the test")
|
||||
_context = Context()
|
||||
|
||||
yield _context.llm_api
|
||||
|
||||
logger.info("Tearing down the test")
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def mock_llm():
|
||||
# Create a mock LLM for testing
|
||||
return Mock()
|
||||
Loading…
Add table
Add a link
Reference in a new issue