示例#1
0
def test_validate_install_cli_args_rejects_invalid_absolute_paths(
        args, tmpdir):
    invalid_path = Path(tmpdir) / "does_not_exist"
    args.ethpm_dir = invalid_path

    with pytest.raises(InstallError):
        validate_install_cli_args(args)
示例#2
0
def install_action(args: argparse.Namespace) -> None:
    validate_install_cli_args(args)
    config = Config(args)
    package = Package(args, config.ipfs_backend)
    install_package(package, config)
    cli_logger.info(
        "%s package sourced from %s installed to %s.",
        package.alias,
        args.uri,
        config.ethpm_dir,
    )
示例#3
0
def test_validate_install_cli_args_rejects_invalid_relative_paths(
        args, tmpdir, monkeypatch):
    args.ethpm_dir = Path("./invalid")

    with pytest.raises(InstallError):
        validate_install_cli_args(args)
示例#4
0
def test_validate_install_cli_args_validates_relative_paths_to_cwd(args):
    args.ethpm_dir = Path("./_ethpm_packages")

    assert validate_install_cli_args(args) is None
示例#5
0
def test_validate_install_cli_args_validates_absolute_ethpm_dir_paths(
        args, tmpdir):
    ethpm_dir = Path(tmpdir) / ETHPM_PACKAGES_DIR
    args.ethpm_dir = ethpm_dir

    assert validate_install_cli_args(args) is None
示例#6
0
def test_validate_install_cli_args_rejects_unsupported_uris(uri, args):
    args.uri = uri

    with pytest.raises(UriNotSupportedError):
        validate_install_cli_args(args)
示例#7
0
def test_validate_install_cli_args_validates_supported_uris(uri, args):
    args.uri = uri

    assert validate_install_cli_args(args) is None
示例#8
0
def test_validate_install_cli_args_rejects_invalid_aliases(alias, args):
    args.alias = alias

    with pytest.raises(ValidationError):
        validate_install_cli_args(args)