Beispiel #1
0
def pip(
    request,
    nix,
    project_dir,
    current_platform,
    logger,
    requirement_parser: RequirementParser,
):
    if request.param == "nix":
        return NixPip(
            nix=nix,
            project_directory=project_dir,
            extra_build_inputs=[],
            extra_env="",
            wheels_cache=[],
            target_platform=current_platform,
            logger=logger,
            requirement_parser=requirement_parser,
        )
    else:
        pip = VirtualenvPip(
            logger=logger,
            target_platform=current_platform,
            target_directory=os.path.join(project_dir, "venv-pip"),
            env_builder=venv.EnvBuilder(with_pip=True),
            requirement_parser=requirement_parser,
        )
        pip.prepare_virtualenv()
        return pip
def test_pip_without_index_cannot_be_prepared_without_wheel_supplied(
    logger: Logger,
    current_platform: TargetPlatform,
    project_dir: str,
    requirement_parser: RequirementParser,
) -> None:
    pip = VirtualenvPip(
        logger=logger,
        target_platform=current_platform,
        target_directory=os.path.join(project_dir, "pip-without-index-venv"),
        env_builder=venv.EnvBuilder(with_pip=True),
        no_index=True,
        requirement_parser=requirement_parser,
    )
    with pytest.raises(PipFailed):
        pip.prepare_virtualenv()
def pip_without_index(
    logger: Logger,
    current_platform: TargetPlatform,
    project_dir: str,
    wheel_distribution_archive_path: str,
    requirement_parser: RequirementParser,
) -> VirtualenvPip:
    pip = VirtualenvPip(
        logger=logger,
        target_platform=current_platform,
        target_directory=os.path.join(project_dir, "pip-without-index-venv"),
        env_builder=venv.EnvBuilder(with_pip=True),
        no_index=True,
        wheel_distribution_path=wheel_distribution_archive_path,
        requirement_parser=requirement_parser,
    )
    pip.prepare_virtualenv()
    return pip