Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fix test_an ut failed without simulator

better629ec88e63c39d9
diff --git a/metagpt/environment/werewolf/env_space.py b/metagpt/environment/werewolf/env_space.py
index 30a0fa01d..e6243b10f 100644
--- a/metagpt/environment/werewolf/env_space.py
+++ b/metagpt/environment/werewolf/env_space.py
@@ -39,7 +39,9 @@ def get_observation_space() -> spaces.Dict:
(spaces.Text(16), spaces.Text(16))
), # TODO should be tuple of variable length
"player_hunted": spaces.Text(16),
- "player_current_dead": spaces.Tuple((spaces.Text(16))), # TODO should be tuple of variable length
+ "player_current_dead": spaces.Tuple(
+ (spaces.Text(16), spaces.Text(16))
+ ), # TODO should be tuple of variable length
"witch_poison_left": spaces.Discrete(2),
"witch_antidote_left": spaces.Discrete(2),
"winner": spaces.Text(16),
diff --git a/tests/metagpt/ext/android_assistant/test_an.py b/tests/metagpt/ext/android_assistant/test_an.py
index d4f398337..ea3e9ccb1 100644
--- a/tests/metagpt/ext/android_assistant/test_an.py
+++ b/tests/metagpt/ext/android_assistant/test_an.py
@@ -6,6 +6,7 @@ import asyncio
import time
from pathlib import Path
+import metagpt
from metagpt.const import TEST_DATA_PATH
from metagpt.environment.android.android_env import AndroidEnv
from metagpt.ext.android_assistant.actions.manual_record import ManualRecord
@@ -14,6 +15,10 @@ from metagpt.ext.android_assistant.actions.screenshot_parse import ScreenshotPar
from metagpt.ext.android_assistant.actions.self_learn_and_reflect import (
SelfLearnAndReflect,
)
+from tests.metagpt.environment.android_env.test_android_ext_env import (
+ mock_device_shape,
+ mock_list_devices,
+)
TASK_PATH = TEST_DATA_PATH.joinpath("andriod_assistant/unitest_Contacts")
TASK_PATH.mkdir(parents=True, exist_ok=True)
@@ -25,6 +30,11 @@ device_id = "emulator-5554"
xml_dir = Path("/sdcard")
screenshot_dir = Path("/sdcard/Pictures/Screenshots")
+
+metagpt.environment.android.android_ext_env.AndroidExtEnv.execute_adb_with_cmd = mock_device_shape
+metagpt.environment.android.android_ext_env.AndroidExtEnv.list_devices = mock_list_devices
+
+
test_env_self_learn_android = AndroidEnv(
device_id=device_id,
xml_dir=xml_dir,