remove global config

This commit is contained in:
shenchucheng 2024-08-13 22:34:12 +08:00
parent 6e0990f251
commit 2968c181c1
39 changed files with 193 additions and 123 deletions

View file

@ -2,13 +2,14 @@ import asyncio
import json
from datetime import datetime
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.const import DEFAULT_WORKSPACE_ROOT, METAGPT_ROOT
from metagpt.logs import logger
from metagpt.roles.di.swe_agent import SWEAgent
from metagpt.tools.libs.terminal import Terminal
from metagpt.tools.swe_agent_commands.swe_agent_utils import load_hf_dataset
config = Config.default()
# Specify by yourself
TEST_REPO_DIR = METAGPT_ROOT / "data" / "test_repo"
DATA_DIR = METAGPT_ROOT / "data/hugging_face"

View file

@ -5,10 +5,12 @@
@Author : alexanderwu
@File : test_document.py
"""
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.document import Repo
from metagpt.logs import logger
config = Config.default()
def set_existing_repo(path):
repo1 = Repo.from_path(path)

View file

@ -12,9 +12,11 @@ from pathlib import Path
import pytest
from azure.cognitiveservices.speech import ResultReason, SpeechSynthesizer
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.tools.azure_tts import AzureTTS
config = Config.default()
@pytest.mark.asyncio
async def test_azure_tts(mocker):

View file

@ -10,9 +10,11 @@ from unittest.mock import AsyncMock
import pytest
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.tools.metagpt_text_to_image import oas3_metagpt_text_to_image
config = Config.default()
@pytest.mark.asyncio
async def test_draw(mocker):

View file

@ -8,10 +8,12 @@
import pytest
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.llm import LLM
from metagpt.tools.moderation import Moderation
config = Config.default()
@pytest.mark.asyncio
@pytest.mark.parametrize(

View file

@ -11,7 +11,7 @@ import openai
import pytest
from pydantic import BaseModel
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.llm import LLM
from metagpt.tools.openai_text_to_image import (
OpenAIText2Image,
@ -19,6 +19,8 @@ from metagpt.tools.openai_text_to_image import (
)
from metagpt.utils.s3 import S3
config = Config.default()
@pytest.mark.asyncio
async def test_draw(mocker):

View file

@ -20,10 +20,12 @@ from openai.types.chat.chat_completion_message_tool_call import (
Function,
)
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.const import API_QUESTIONS_PATH, UT_PY_PATH
from metagpt.tools.ut_writer import YFT_PROMPT_PREFIX, UTGenerator
config = Config.default()
class TestUTWriter:
@pytest.mark.asyncio

View file

@ -2,7 +2,9 @@
# -*- coding: utf-8 -*-
# @Desc : unittest of repair_llm_raw_output
from metagpt.config2 import config
from metagpt.config2 import Config
config = Config.default()
"""
CONFIG.repair_llm_output should be True before retry_parse_json_text imported.