🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
refactor: unit test
莘权 马360f5dcd1b69
diff --git a/tests/metagpt/utils/test_redis.py b/tests/metagpt/utils/test_redis.pyindex d499418ac..140c04f6b 100644--- a/tests/metagpt/utils/test_redis.py+++ b/tests/metagpt/utils/test_redis.py@@ -5,8 +5,8 @@@Author : mashenquan@File : test_redis.py"""+from unittest.mock import AsyncMock-import mockimport pytestfrom metagpt.config import CONFIG@@ -14,20 +14,16 @@ from metagpt.utils.redis import Redisasync def async_mock_from_url(*args, **kwargs):- mock_client = mock.AsyncMock()+ mock_client = AsyncMock()mock_client.set.return_value = Nonemock_client.get.side_effect = [b"test", b""]return mock_client@pytest.mark.asyncio[email protected]("aioredis.from_url", return_value=async_mock_from_url())-async def test_redis(mock_from_url):+async def test_redis(mocker):# Mock- # mock_client = mock.AsyncMock()- # mock_client.set.return_value=None- # mock_client.get.side_effect = [b'test', b'']- # mock_from_url.return_value = mock_client+ mocker.patch("aioredis.from_url", return_value=async_mock_from_url())# PrerequisitesCONFIG.REDIS_HOST = "MOCK_REDIS_HOST"