示例#1
0
def test_init_with_custom_config(py_recipe):
    """This is the command that takes the initial staged-recipe folder and turns it into a
    feedstock"""
    # actual parser doesn't matter.  It's used for initialization only
    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers()
    init_obj = cli.Init(subparser)
    recipe = py_recipe.recipe
    # expected args object has

    with open(os.path.join(recipe, "recipe", "conda-forge.yml"), "w") as fp:
        fp.write(
            dedent(
                """\
            bot:
              automerge: true
              run_deps_from_wheel: true
            """
            )
        )

    args = InitArgs(
        recipe_directory=os.path.join(recipe, "recipe"),
        feedstock_directory=os.path.join(recipe, "{package.name}-feedstock"),
        temporary_directory=os.path.join(recipe, "temp"),
    )
    init_obj(args)
    destination = os.path.join(recipe, "py-test-feedstock")
    assert os.path.isdir(destination)
    data = yaml.safe_load(
        open(os.path.join(destination, "conda-forge.yml"), "r").read()
    )
    assert data.get("bot") != None
    assert data["bot"]["automerge"] == True
    assert data["bot"]["run_deps_from_wheel"] == True
示例#2
0
def test_init_multiple_docker_images(testing_workdir):
    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers()
    init_obj = cli.Init(subparser)
    regen_obj = cli.Regenerate(subparser)
    recipe = os.path.join(_thisdir, "recipes", "multiple_docker_images")
    feedstock_dir = os.path.join(testing_workdir,
                                 "multiple_docker_images-feedstock")
    args = InitArgs(recipe_directory=recipe, feedstock_directory=feedstock_dir)
    init_obj(args)
    # Ignore conda-forge-pinning for this test, as the test relies on
    # conda-forge-pinning not being present
    args = RegenerateArgs(
        feedstock_directory=feedstock_dir,
        commit=False,
        no_check_uptodate=True,
        exclusive_config_file="recipe/conda_build_config.yaml",
        check=False,
    )
    regen_obj(args)
    matrix_dir = os.path.join(feedstock_dir, ".ci_support")
    # the matrix should be consolidated among all outputs, as well as the
    # top-level reqs. Only the top-level reqs should have indedependent config
    # files, though - loops within outputs are contained in those top-level
    # configs.
    matrix_dir_len = len(os.listdir(matrix_dir))
    assert matrix_dir_len == 2
    fn = os.path.join(matrix_dir, "linux_.yaml")
    assert os.path.isfile(fn)
    with open(fn) as fh:
        config = yaml.load(fh)
    assert config["docker_image"] == ["pickme_a"]
示例#3
0
def test_init_cuda_docker_images(testing_workdir):
    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers()
    init_obj = cli.Init(subparser)
    regen_obj = cli.Regenerate(subparser)
    recipe = os.path.join(_thisdir, "recipes", "cuda_docker_images")
    feedstock_dir = os.path.join(
        testing_workdir, "cuda_docker_images-feedstock"
    )
    args = InitArgs(
        recipe_directory=recipe,
        feedstock_directory=feedstock_dir,
        temporary_directory=os.path.join(recipe, "temp"),
    )
    init_obj(args)
    # Ignore conda-forge-pinning for this test, as the test relies on
    # conda-forge-pinning not being present
    args = RegenerateArgs(
        feedstock_directory=feedstock_dir,
        feedstock_config=None,
        commit=False,
        no_check_uptodate=True,
        exclusive_config_file="recipe/conda_build_config.yaml",
        check=False,
        temporary_directory=os.path.join(recipe, "temp"),
    )
    regen_obj(args)
    matrix_dir = os.path.join(feedstock_dir, ".ci_support")
    # the matrix should be consolidated among all outputs, as well as the
    # top-level reqs. Only the top-level reqs should have indedependent config
    # files, though - loops within outputs are contained in those top-level
    # configs.
    matrix_dir_len = len(os.listdir(matrix_dir))
    assert matrix_dir_len == 7  # 6 docker images plus the README
    for v in [None, "9.2", "10.0", "10.1", "10.2", "11.0"]:
        fn = os.path.join(
            matrix_dir, f"linux_64_cuda_compiler_version{v}.yaml"
        )
        assert os.path.isfile(fn)
        with open(fn) as fh:
            config = yaml.safe_load(fh)
        assert config["cuda_compiler"] == ["nvcc"]
        assert config["cuda_compiler_version"] == [f"{v}"]
        if v is None:
            docker_image = "condaforge/linux-anvil-comp7"
        else:
            docker_image = f"condaforge/linux-anvil-cuda:{v}"
        assert config["docker_image"] == [docker_image]
        if v == "11.0":
            assert config["cdt_name"] == ["cos7"]
        else:
            assert config["cdt_name"] == ["cos6"]
示例#4
0
def test_init_multiple_output_matrix(testing_workdir):
    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers()
    init_obj = cli.Init(subparser)
    regen_obj = cli.Regenerate(subparser)
    recipe = os.path.join(_thisdir, "recipes", "multiple_outputs")
    feedstock_dir = os.path.join(
        testing_workdir, "multiple-outputs-test-feedstock"
    )
    args = InitArgs(
        recipe_directory=recipe,
        feedstock_directory=feedstock_dir,
        temporary_directory=os.path.join(recipe, "temp"),
    )
    init_obj(args)
    # Ignore conda-forge-pinning for this test, as the test relies on conda-forge-pinning
    # not being present
    args = RegenerateArgs(
        feedstock_directory=feedstock_dir,
        feedstock_config=None,
        commit=False,
        no_check_uptodate=True,
        exclusive_config_file="recipe/conda_build_config.yaml",
        check=False,
        temporary_directory=os.path.join(recipe, "temp"),
    )
    regen_obj(args)
    matrix_dir = os.path.join(feedstock_dir, ".ci_support")
    # the matrix should be consolidated among all outputs, as well as the top-level
    # reqs. Only the top-level reqs should have indedependent config files,
    # though - loops within outputs are contained in those top-level configs.
    matrix_dir_len = len(os.listdir(matrix_dir))
    assert matrix_dir_len == 13
    linux_libpng16 = os.path.join(
        matrix_dir, "linux_64_libpng1.6libpq9.5.yaml"
    )
    assert os.path.isfile(linux_libpng16)
    with open(linux_libpng16) as f:
        config = yaml.safe_load(f)
    assert config["libpng"] == ["1.6"]
    assert config["libpq"] == ["9.5"]
    # this is a zipped key, but it's not used, so it shouldn't show up
    assert "libtiff" not in config
    assert "zip_keys" not in config or not any(
        "libtiff" in group for group in config["zip_keys"]
    )
    # this is a variable only for one of the outputs
    assert config["jpeg"] == ["8", "9"]
    # this is in conda_build_config.yaml, but is a transitive dependency.  It should
    #     not show up in the final configs.
    assert "zlib" not in config
示例#5
0
def test_init(py_recipe):
    """This is the command that takes the initial staged-recipe folder and turns it into a
    feedstock"""
    # actual parser doesn't matter.  It's used for initialization only
    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers()
    init_obj = cli.Init(subparser)
    recipe = py_recipe.recipe
    # expected args object has
    args = InitArgs(recipe_directory=os.path.join(recipe, 'recipe'),
                    feedstock_directory=os.path.join(
                        recipe, '{package.name}-feedstock'))
    init_obj(args)
    destination = os.path.join(recipe, 'py-test-feedstock')
    assert os.path.isdir(destination)
示例#6
0
def test_init_multiple_output_matrix(testing_workdir):
    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers()
    init_obj = cli.Init(subparser)
    regen_obj = cli.Regenerate(subparser)
    recipe = os.path.join(_thisdir, 'recipes', 'multiple_outputs')
    feedstock_dir = os.path.join(testing_workdir,
                                 'multiple-outputs-test-feedstock')
    args = InitArgs(recipe_directory=recipe, feedstock_directory=feedstock_dir)
    init_obj(args)
    # Ignore conda-forge-pinning for this test, as the test relies on conda-forge-pinning
    # not being present
    args = RegenerateArgs(
        feedstock_directory=feedstock_dir,
        commit=False,
        no_check_uptodate=True,
        exclusive_config_file="recipe/conda_build_config.yaml")
    regen_obj(args)
    matrix_dir = os.path.join(feedstock_dir, '.ci_support')
    # the matrix should be consolidated among all outputs, as well as the top-level
    # reqs. Only the top-level reqs should have indedependent config files,
    # though - loops within outputs are contained in those top-level configs.
    matrix_dir_len = len(os.listdir(matrix_dir))
    assert matrix_dir_len == 13
    linux_libpng16 = os.path.join(matrix_dir, 'linux_libpng1.6libpq9.5.yaml')
    assert os.path.isfile(linux_libpng16)
    with open(linux_libpng16) as f:
        config = yaml.load(f)
    assert config['libpng'] == ['1.6']
    assert config['libpq'] == ['9.5']
    # this is a zipped key, but it's not used, so it shouldn't show up
    assert 'libtiff' not in config
    assert 'zip_keys' not in config or not any('libtiff' in group
                                               for group in config['zip_keys'])
    # this is a variable only for one of the outputs
    assert config['jpeg'] == ['8', '9']
    # this is in conda_build_config.yaml, but is a transitive dependency.  It should
    #     not show up in the final configs.
    assert 'zlib' not in config