def setup_class(cls): """Set the tests up.""" cls.patch = unittest.mock.patch.object(aea.registries.base.logger, "exception") cls.mocked_logger = cls.patch.start() cls.oldcwd = os.getcwd() cls.agent_name = "agent_dir_test" cls.t = tempfile.mkdtemp() cls.agent_folder = os.path.join(cls.t, cls.agent_name) shutil.copytree(os.path.join(CUR_PATH, "data", "dummy_aea"), cls.agent_folder) os.chdir(cls.agent_folder) cls.registry = AgentComponentRegistry() protocol_1 = Protocol.from_dir(Path(aea.AEA_DIR, "protocols", "default")) protocol_2 = Protocol.from_dir( Path(ROOT_DIR, "packages", "fetchai", "protocols", "fipa"), ) cls.registry.register(protocol_1.component_id, protocol_1) cls.registry.register(protocol_2.component_id, protocol_2) cls.expected_protocol_ids = { DEFAULT_PROTOCOL, PublicId.from_str("fetchai/fipa:0.4.0"), }
def __init__(self) -> None: """ Instantiate the resources. :return None """ self._component_registry = AgentComponentRegistry() self._handler_registry = HandlerRegistry() self._behaviour_registry = ComponentRegistry[Behaviour]() self._model_registry = ComponentRegistry[Model]() self._registries = [ self._component_registry, self._handler_registry, self._behaviour_registry, self._model_registry, ] # type: List[Registry]
def setup_class(cls): """Set the tests up.""" cls.oldcwd = os.getcwd() cls.agent_name = "agent_dir_test" cls.t = tempfile.mkdtemp() cls.agent_folder = os.path.join(cls.t, cls.agent_name) shutil.copytree(os.path.join(CUR_PATH, "data", "dummy_aea"), cls.agent_folder) os.chdir(cls.agent_folder) contract = Contract.from_dir( str(Path(ROOT_DIR, "packages", "fetchai", "contracts", "erc1155")) ) cls.registry = AgentComponentRegistry() cls.patch = unittest.mock.patch.object(cls.registry.logger, "exception") cls.mocked_logger = cls.patch.start() cls.registry.register(contract.component_id, cast(Contract, contract)) cls.expected_contract_ids = {ERC1155_PUBLIC_ID}
def __init__(self, agent_name: str = "standalone") -> None: """ Instantiate the resources. :return None """ self._agent_name = agent_name self._component_registry = AgentComponentRegistry( agent_name=agent_name) self._specification_to_protocol_id: Dict[PublicId, PublicId] = {} self._handler_registry = HandlerRegistry(agent_name=agent_name) self._behaviour_registry = ComponentRegistry[Behaviour]( agent_name=agent_name) self._model_registry = ComponentRegistry[Model](agent_name=agent_name) self._registries = [ self._component_registry, self._handler_registry, self._behaviour_registry, self._model_registry, ] # type: List[Registry]
def setup_class(self): """Set up the test.""" self.registry = AgentComponentRegistry()