Exemplo n.º 1
0
def test_find_component_failed():
    """Test fail on compomnent not found."""
    builder = AEABuilder()
    builder.set_name("aea_1")
    builder.add_private_key("fetchai")
    a_protocol = Protocol(
        ProtocolConfig("a_protocol", "author", "0.1.0"), DefaultMessage
    )
    with pytest.raises(ValueError, match=r"Package .* not found"):
        builder.find_component_directory_from_component_id(
            Path("/some_dir"), a_protocol.component_id
        )
Exemplo n.º 2
0
    def get_component_directory(package_id: PackageId) -> Path:
        """Return path for package."""
        try:
            return AEABuilder.find_component_directory_from_component_id(
                Path("."),
                ComponentId(str(package_id.package_type), package_id.public_id),
            )

        except ValueError:
            raise click.ClickException(
                f"Can not find folder for the package: {package_id.package_type} {package_id.public_id}"
            )