Merge pull request #1184 from better629/feat_werewolf

Feat fix test_an ut failed without simulator
This commit is contained in:
Alexander Wu 2024-04-11 21:11:51 +08:00 committed by GitHub
commit aa715fcace
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -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),

View file

@ -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,