def test_289_github_url_version_placeholder():
    recipe, _ = create_python_recipe(
        "https://github.com/spdx/spdx-license-matcher", version="2.1"
    )
    assert (
        recipe["source"]["url"]
        == "https://github.com/spdx/spdx-license-matcher/archive/v{{ version }}.tar.gz"
    )
Example #2
0
def test_create_recipe_from_local_sdist(pkg_pytest):
    recipe = create_python_recipe(pkg_pytest, from_local_sdist=True)[0]
    assert recipe["source"]["url"] == f"file://{pkg_pytest}"
    assert recipe["about"]["home"] == "https://docs.pytest.org/en/latest/"
    assert recipe["about"][
        "summary"] == "pytest: simple powerful testing with Python"
    assert recipe["about"]["license"] == "MIT"
    assert recipe["about"]["license_file"] == "LICENSE"
Example #3
0
def test_pytest_recipe_entry_points():
    recipe = create_python_recipe("pytest=5.3.5", is_strict_cf=False)[0]
    assert sorted(recipe["build"]["entry_points"]) == sorted(
        ["pytest=pytest:main", "py.test=pytest:main"])
    assert recipe["about"]["license"] == "MIT"
    assert recipe["about"]["license_file"] == "LICENSE"
    assert "skip" in recipe["build"]
    assert recipe["build"]["skip"].inline_comment == "# [py2k]"
    assert not recipe["build"]["noarch"]
    assert sorted(recipe["test"]["commands"]) == sorted(
        ["py.test --help", "pytest --help", "pip check"])
Example #4
0
def test_sequence_inside_another_in_dependencies():
    recipe = create_python_recipe("unittest2=1.1.0", is_strict_cf=True)[0]
    assert recipe["requirements"]["host"] == [
        "argparse",
        "pip",
        "python >=3.6",
        "six >=1.4",
        "traceback2",
    ]
    assert recipe["requirements"]["run"] == [
        "argparse",
        "python >=3.6",
        "six >=1.4",
        "traceback2",
    ]
Example #5
0
def make_grayskull_recipe(attrs, version_key="version"):
    """Make a grayskull recipe given bot node attrs.

    Parameters
    ----------
    attrs : dict or LazyJson
        The node attrs.
    version_key : str, optional
        The version key to use from the attrs. Default is "version".

    Returns
    -------
    recipe : str
        The generated grayskull recipe as a string.
    """
    pkg_version = attrs[version_key]
    pkg_name = attrs["name"]
    is_noarch = "noarch: python" in attrs["raw_meta_yaml"]
    logger.info(
        "making grayskull recipe for pkg %s w/ version %s",
        pkg_name,
        pkg_version,
    )
    recipe, _ = create_python_recipe(
        pkg_name=pkg_name,
        version=pkg_version,
        download=False,
        is_strict_cf=True,
        from_local_sdist=False,
        is_arch=not is_noarch,
    )

    with tempfile.TemporaryDirectory() as td:
        pth = os.path.join(td, "meta.yaml")
        recipe.save(pth)
        with open(pth) as f:
            out = f.read()

    # code around a grayskull bug
    # see https://github.com/conda-incubator/grayskull/issues/295
    if "[py>=40]" in out:
        out = out.replace("[py>=40]", "[py>=400]")

    logger.info("grayskull recipe:\n%s", out)

    return out
Example #6
0
def grayskull_audit_feedstock(fctx: FeedstockContext, ctx: MigratorSessionContext):
    """Uses grayskull to audit the requirements for a python package"""
    # TODO: come back to this, since CF <-> PyPI is not one-to-one and onto
    pkg_version = fctx.attrs["version"]
    pkg_name = fctx.package_name
    recipe, _ = create_python_recipe(
        pkg_name=pkg_name,
        version=pkg_version,
        download=False,
        is_strict_cf=True,
        from_local_sdist=False,
    )

    with tempfile.TemporaryDirectory() as td:
        pth = os.path.join(td, "meta.yaml")
        recipe.save(pth)
        with open(pth) as f:
            out = f.read()
    return out
Example #7
0
def test_noarch_metadata():
    recipe = create_python_recipe("policy_sentry=0.11.16")[0]
    assert recipe["build"]["noarch"] == "python"
Example #8
0
def test_keep_filename_license(name):
    recipe = create_python_recipe(name)[0]
    assert recipe["about"]["license_file"] == "LICENSE.md"
Example #9
0
def test_400_for_python_selector():
    recipe = create_python_recipe("pyquil", version="3.0.1")[0]
    assert recipe["build"]["skip"].selector == "py>=400 or py2k"
Example #10
0
def test_pep440_recipe():
    recipe = create_python_recipe("codalab=0.5.26", is_strict_cf=False)[0]
    assert recipe["requirements"]["host"] == ["pip", "python >=3.6"]
Example #11
0
def test_pep440_in_recipe_pypi():
    recipe = create_python_recipe("kedro=0.17.6", is_strict_cf=False)[0]
    assert sorted(
        recipe["requirements"]["run"])[0] == "anyconfig >=0.10.0,==0.10.*"
Example #12
0
def test_replace_slash_in_imports():
    recipe = create_python_recipe("asgi-lifespan=1.0.1")[0]
    assert ["asgi_lifespan"] == recipe["test"]["imports"]
Example #13
0
def test_add_python_min_to_strict_conda_forge():
    recipe = create_python_recipe("dgllife=0.2.8", is_strict_cf=True)[0]
    assert recipe["build"]["noarch"] == "python"
    assert recipe["requirements"]["host"][1] == "python >=3.6"
    assert "python >=3.6" in recipe["requirements"]["run"]
Example #14
0
def test_tzdata_without_setup_py():
    recipe = create_python_recipe("tzdata=2020.1")[0]
    assert recipe["build"]["noarch"] == "python"
    assert recipe["about"]["home"] == "https://github.com/python/tzdata"
Example #15
0
def test_multiples_exit_setup():
    """Bug fix #146"""
    assert create_python_recipe("pyproj=2.6.1")[0]
Example #16
0
def test_empty_entry_points():
    recipe = create_python_recipe("modulegraph=0.18")[0]
    assert recipe["build"]["entry_points"] == [
        "modulegraph = modulegraph.__main__:main"
    ]
Example #17
0
def test_recipe_extension():
    recipe = create_python_recipe("azure-identity=1.3.1")[0]
    assert (recipe["source"]["url"] ==
            "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/"
            "azure-identity-{{ version }}.zip")
Example #18
0
def test_recipe_with_just_py_modules():
    recipe = create_python_recipe("python-markdown-math=0.7")[0]
    assert recipe["test"]["imports"] == ["mdx_math"]
Example #19
0
def test_arch_metadata():
    recipe = create_python_recipe("remove_dagmc_tags=0.0.5")[0]
    assert "noarch" not in recipe["build"]
Example #20
0
def test_build_noarch_skip(name):
    recipe = create_python_recipe(name)[0]
    assert recipe["build"]["noarch"] == "python"
    assert "skip" not in recipe["build"]