Ejemplo n.º 1
0
def test_poetry_version_parsing_constraints(package, version, url_pattern):
    _conda_exe = determine_conda_executable("conda", no_mamba=True)
    spec = LockSpecification(
        specs=[
            to_match_spec(package, poetry_version_to_conda_version(version))
        ],
        channels=["conda-forge"],
        platform="linux-64",
    )
    lockfile_contents = create_lockfile_from_spec(conda=_conda_exe,
                                                  channels=spec.channels,
                                                  spec=spec)

    for line in lockfile_contents:
        if url_pattern in line:
            break
    else:
        raise ValueError(f"could not find {package} {version}")
Ejemplo n.º 2
0
def test_poetry_version_parsing_constraints(package, version, url_pattern,
                                            capsys):
    _conda_exe = determine_conda_executable(None,
                                            mamba=False,
                                            micromamba=False)

    vpr = default_virtual_package_repodata()
    with vpr, capsys.disabled():
        with tempfile.NamedTemporaryFile(dir=".") as tf:
            spec = LockSpecification(
                dependencies=[
                    VersionedDependency(
                        name=package,
                        version=poetry_version_to_conda_version(version),
                        manager="conda",
                        optional=False,
                        category="main",
                        extras=[],
                    )
                ],
                channels=["conda-forge"],
                platforms=["linux-64"],
                # NB: this file must exist for relative path resolution to work
                # in create_lockfile_from_spec
                sources=[pathlib.Path(tf.name)],
                virtual_package_repo=vpr,
            )
            lockfile_contents = create_lockfile_from_spec(
                conda=_conda_exe,
                spec=spec,
                lockfile_path=pathlib.Path(DEFAULT_LOCKFILE_NAME),
            )

        python = next(p for p in lockfile_contents.package
                      if p.name == "python")
        assert url_pattern in python.url
Ejemplo n.º 3
0
def conda_exe():
    return determine_conda_executable("conda", no_mamba=True)