def test_env_matrix(): contents = {'CONDA_PY': [27, 35], 'CONDA_BOOST': '1.60'} with open(tempfile.NamedTemporaryFile().name, 'w') as fout: fout.write(yaml.dump(contents, default_flow_style=False)) e1 = utils.EnvMatrix(contents) e2 = utils.EnvMatrix(fout.name) assert e1.env == e2.env assert sorted([sorted(i) for i in e1]) == sorted([sorted(i) for i in e2]) == [[ ('CONDA_BOOST', '1.60'), ('CONDA_PY', 27), ], [ ('CONDA_BOOST', '1.60'), ('CONDA_PY', 35), ]]
def _build_pkg(recipe): r = Recipes(recipe, from_string=True) r.write_recipes() env_matrix = list(utils.EnvMatrix(tmp_env_matrix()))[0] recipe = r.recipe_dirs['one'] built_package = utils.built_package_path(recipe) ensure_missing(built_package) build.build(recipe=r.recipe_dirs['one'], recipe_folder='.', env=env_matrix) return built_package
def single_build(request, recipes_fixture): """ Builds the "one" recipe. """ env_matrix = list(utils.EnvMatrix(tmp_env_matrix()))[0] if request.param: docker_builder = docker_utils.RecipeBuilder(use_host_conda_bld=True) else: docker_builder = None build.build( recipe=recipes_fixture.recipe_dirs['one'], recipe_folder='.', docker_builder=docker_builder, env=env_matrix, ) built_package = recipes_fixture.pkgs['one'] yield built_package ensure_missing(built_package)
def single_upload(): """ Creates a randomly-named recipe and uploads it using a label so that it doesn't affect the main bioconda channel. Tests that depend on this fixture get a tuple of name, pakage, recipe dir. Cleans up when it's done. """ name = 'upload-test-' + str(uuid.uuid4()).split('-')[0] r = Recipes(''' {0}: meta.yaml: | package: name: {0} version: "0.1" '''.format(name), from_string=True) r.write_recipes() env_matrix = list(utils.EnvMatrix(tmp_env_matrix()))[0] build.build( recipe=r.recipe_dirs[name], recipe_folder='.', docker_builder=None, mulled_test=False, env=env_matrix, ) pkg = utils.built_package_path(r.recipe_dirs[name]) with utils.temp_env( dict(TRAVIS_BRANCH='master', TRAVIS_PULL_REQUEST='false')): upload.anaconda_upload(pkg, label=TEST_LABEL) yield (name, pkg, r.recipe_dirs[name]) p = sp.run([ 'anaconda', '-t', os.environ.get('ANACONDA_TOKEN'), 'remove', 'bioconda/{0}'.format(name), '--force' ], stdout=sp.PIPE, stderr=sp.STDOUT, check=True, universal_newlines=True)
def _build_pkg(): r = Recipes(dedent(""" one: meta.yaml: | package: name: one version: 0.1 test: commands: - "ls -la" """), from_string=True) r.write_recipes() env_matrix = list(utils.EnvMatrix(tmp_env_matrix()))[0] recipe = r.recipe_dirs['one'] built_package = utils.built_package_path(recipe) ensure_missing(built_package) build.build(recipe=r.recipe_dirs['one'], recipe_folder='.', env=env_matrix) return built_package