def test_filter_recipes_skip_py27_in_build_string(): """ When CONDA_PY is in the build string, py27 should be skipped """ r = Recipes(""" one: meta.yaml: | package: name: one version: "0.1" requirements: build: - python run: - python """, from_string=True) r.write_recipes() env_matrix = { 'CONDA_PY': [27, 35], } recipes = list(r.recipe_dirs.values()) filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'])) # one recipe, two targets assert len(filtered) == 1 assert len(filtered[0][1]) == 2 r = Recipes(""" one: meta.yaml: | package: name: one version: "0.1" build: skip: True # [py27] requirements: build: - python run: - python """, from_string=True) r.write_recipes() env_matrix = { 'CONDA_PY': [27, 35], } recipes = list(r.recipe_dirs.values()) filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'])) # one recipe, one target assert len(filtered) == 1 assert len(filtered[0][1]) == 1
def test_filter_recipes_force_existing_package(): "same as above but force the recipe" # same as above, but this time force the recipe # TODO: refactor as py.test fixture r = Recipes(""" one: meta.yaml: | package: name: gffutils version: "0.8.7.1" requirements: run: - python """, from_string=True) r.write_recipes() recipes = list(r.recipe_dirs.values()) env_matrix = { 'CONDA_PY': [27, 35], } pkgs = utils.get_channel_packages('bioconda') pth = utils.built_package_path(recipes[0]) filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'], force=True)) assert len(filtered) == 1
def test_filter_recipes_custom_buildstring(): "use a known-to-exist package in bioconda" # note that we need python as a run requirement in order to get the "pyXY" # in the build string that matches the existing bioconda built package. r = Recipes(""" one: meta.yaml: | package: name: pindel version: "0.2.5b8" build: number: 2 skip: True # [osx] string: "htslib{{CONDA_HTSLIB}}_{{PKG_BUILDNUM}}" requirements: run: - python """, from_string=True) r.write_recipes() recipes = list(r.recipe_dirs.values()) env_matrix = { 'CONDA_HTSLIB': "1.4", } filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'])) assert len(filtered) == 0
def test_filter_recipes_existing_package(): "use a known-to-exist package in bioconda" # note that we need python as a run requirement in order to get the "pyXY" # in the build string that matches the existing bioconda built package. r = Recipes(""" one: meta.yaml: | package: name: gffutils version: "0.8.7.1" requirements: run: - python """, from_string=True) r.write_recipes() recipes = list(r.recipe_dirs.values()) env_matrix = { 'CONDA_PY': [27, 35], } pkgs = utils.get_channel_packages('bioconda') pth = utils.built_package_path(recipes[0]) filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'])) assert len(filtered) == 0
def test_filter_recipes_skip_py27(): """ When we add build/skip = True # [py27] to recipe, it should not be filtered out. This is because python version is not encoded in the output package name, and so one-0.1-0.tar.bz2 will still be created for py35. """ r = Recipes( """ one: meta.yaml: | package: name: one version: "0.1" build: skip: true # [py27] """, from_string=True) r.write_recipes() env_matrix = { 'CONDA_PY': [27, 35], 'CONDA_BOOST': '1.60' } recipes = list(r.recipe_dirs.values()) filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'])) assert len(filtered) == 1
def test_filter_recipes_skip_is_true(): """ """ r = Recipes(""" one: meta.yaml: | package: name: one version: "0.1" build: skip: true """, from_string=True) r.write_recipes() env_matrix = {} recipes = list(r.recipe_dirs.values()) filtered = list(utils.filter_recipes(recipes, env_matrix)) assert len(filtered) == 0
def test_filter_recipes_no_skipping(): """ No recipes have skip so make sure none are filtered out. """ r = Recipes(""" one: meta.yaml: | package: name: one version: "0.1" """, from_string=True) r.write_recipes() env_matrix = {'CONDA_PY': [27, 35], 'CONDA_BOOST': '1.60'} recipes = list(r.recipe_dirs.values()) assert len(recipes) == 1 filtered = list( utils.filter_recipes(recipes, env_matrix, channels=['bioconda'])) assert len(filtered) == 1
def test_zero_packages(): """ Regression test; make sure filter_recipes exits cleanly if no recipes were provided. """ assert list(utils.filter_recipes([], {'CONDA_PY': [27, 35]})) == []