def test_find_import_order(): """Test find import order works on cycle dependency.""" builder = AEABuilder() builder.set_name("aea_1") builder.add_private_key("fetchai") _old_load = ComponentConfiguration.load def _new_load(*args, **kwargs): skill_config = _old_load(*args, **kwargs) skill_config.skills = [Mock()] return skill_config with patch.object(ComponentConfiguration, "load", _new_load): with pytest.raises( AEAException, match=r"Cannot load skills, there is a cyclic dependency."): builder._find_import_order( [ ComponentId(ComponentType.SKILL, PublicId("dummy_author", "dummy", "0.1.0")), ], Path(os.path.join(CUR_PATH, "data", "dummy_aea")), True, )
def test_find_import_order(): """Test find import order works on cycle dependency.""" builder = AEABuilder() builder.set_name("aea_1") builder.add_private_key("fetchai") _old_load = load_component_configuration def _new_load(*args, **kwargs): skill_config = _old_load(*args, **kwargs) # add loop skill_config.skills = [skill_config.public_id] return skill_config with patch("aea.aea_builder.load_component_configuration", _new_load): with pytest.raises( AEAException, match=r"Cannot load skills, there is a cyclic dependency." ): builder._find_import_order( [ComponentId(ComponentType.SKILL, DUMMY_SKILL_PUBLIC_ID)], Path(os.path.join(CUR_PATH, "data", "dummy_aea")), True, )