def test_variants(): """ Multiple variants should return multiple metadata """ r = Recipes( """ one: meta.yaml: | package: name: one version: "0.1" requirements: build: - mypkg {{ mypkg }} """, from_string=True) r.write_recipes() recipe = r.recipe_dirs['one'] # Write a temporary conda_build_config.yaml that we'll point the config # object to: tmp = tempfile.NamedTemporaryFile(delete=False).name with open(tmp, 'w') as fout: fout.write( dedent( """ mypkg: - 1.0 - 2.0 """)) config = utils.load_conda_build_config() config.exclusive_config_file = tmp assert len(utils.load_all_meta(recipe, config)) == 2
def _run(contents, expect_pass=True): """ Build the recipe and run the lint function on the rendered recipe """ r = Recipes(contents, from_string=True) r.write_recipes() assert len(r.recipe_dirs) == 1 name = list(r.recipe_dirs.keys())[0] recipe = Recipe.from_file(r.basedir, r.recipe_dirs[name]) metas = [] for platform in ["linux", "osx"]: config = utils.load_conda_build_config(platform=platform, trim_skip=False) metas.extend(utils.load_all_meta(r.recipe_dirs[name], config=config, finalize=False)) if expect_pass: assert func(recipe, metas) is None, "lint did not pass" else: assert func(recipe, metas) is not None, "lint did not fail"
def _run(contents, expect_pass=True): """ Build the recipe and run the lint function on the rendered recipe """ r = Recipes(contents, from_string=True) r.write_recipes() assert len(r.recipe_dirs) == 1 name = list(r.recipe_dirs.keys())[0] recipe = Recipe.from_file(r.basedir, r.recipe_dirs[name]) metas = [] for platform in ["linux", "osx"]: config = utils.load_conda_build_config(platform=platform, trim_skip=False) metas.extend( utils.load_all_meta(r.recipe_dirs[name], config=config, finalize=False)) if expect_pass: assert func(recipe, metas) is None, "lint did not pass" else: assert func(recipe, metas) is not None, "lint did not fail"