update: delete pytest code

This commit is contained in:
Stitch-z 2023-09-02 10:55:38 +08:00
parent 478139c8dc
commit bfd8ed69e8
3 changed files with 1 additions and 62 deletions

View file

@ -41,5 +41,4 @@ qdrant-client==1.4.0
connexion[swagger-ui]
aiohttp_jinja2
azure-cognitiveservices-speech==1.31.0
aioboto3~=11.3.0
pytest-asyncio~=0.21.1
aioboto3~=11.3.0

View file

@ -16,8 +16,6 @@ from metagpt.provider.openai_api import OpenAIGPTAPI as GPTAPI
import asyncio
import re
from metagpt.utils.s3 import S3
class Context:
def __init__(self):
@ -76,6 +74,3 @@ def proxy():
def init_config():
Config()
@pytest.fixture(scope="session", autouse=True)
def s3():
return S3()

View file

@ -1,55 +0,0 @@
import os
import pytest
@pytest.mark.asyncio
@pytest.mark.parametrize(
["bucket", "local_path", "object_name"],
[
(
"agent-store",
"/code/send18-MetaGPT/workspace/resources/SD_Output/Flappy Bird_output_0.png",
"ui-designer/2023-09-01/1.png"
)
]
)
async def test_upload_file(s3, bucket, local_path, object_name):
await s3.upload_file(bucket=bucket, local_path=local_path, object_name=object_name)
s3_object = await s3.get_object(bucket=bucket, object_name=object_name)
assert s3_object
assert isinstance(s3_object, bytes)
@pytest.mark.asyncio
@pytest.mark.parametrize(
["bucket", "object_name"],
[("agent-store", "ui-designer/2023-09-01/1.png")]
)
async def test_get_object_url(s3, bucket, object_name):
url = await s3.get_object_url(bucket=bucket, object_name=object_name)
assert bucket in url
assert object_name in url
@pytest.mark.asyncio
@pytest.mark.parametrize(
["bucket", "object_name"],
[("agent-store", "ui-designer/2023-09-01/1.png")]
)
async def test_get_object(s3, bucket, object_name):
s3_object = await s3.get_object(bucket=bucket, object_name=object_name)
assert s3_object
assert isinstance(s3_object, bytes)
@pytest.mark.asyncio
@pytest.mark.parametrize(
["bucket", "local_path", "object_name"],
[
(
"agent-store",
"/code/send18-MetaGPT/workspace/resources/SD_Output/Flappy Bird_output_0.png",
"ui-designer/2023-09-01/1.png"
)
]
)
async def test_download_file(s3, bucket, local_path, object_name):
await s3.download_file(bucket=bucket, object_name=object_name, local_path=local_path)
assert os.path.exists(local_path)