def test_r_skips_appveyor(r_recipe, jinja_env):
    cnfgr_fdstk.render_appveyor(jinja_env=jinja_env,
                                forge_config=r_recipe.config,
                                forge_dir=r_recipe.recipe)
    # this configuration should be skipped
    assert not r_recipe.config["appveyor"]["enabled"]
    # no appveyor.yaml should have been written.  Nothing else, either, since we only ran
    #     appveyor render.  No matrix dir should exist.
    assert not os.path.isdir(os.path.join(r_recipe.recipe, ".ci_support"))
def test_py_matrix_appveyor(py_recipe, jinja_env):
    cnfgr_fdstk.render_appveyor(jinja_env=jinja_env,
                                forge_config=py_recipe.config,
                                forge_dir=py_recipe.recipe)
    # this configuration should be skipped
    assert py_recipe.config["appveyor"]["enabled"]
    matrix_dir = os.path.join(py_recipe.recipe, ".ci_support")
    assert os.path.isdir(matrix_dir)
    # 2 python versions, 2 target_platforms.  Recipe uses c_compiler, but this is a zipped key
    #     and shouldn't add extra configurations
    assert len(os.listdir(matrix_dir)) == 4
def test_render_windows_with_skipped_python(python_skipped_recipe, jinja_env):
    config = python_skipped_recipe.config
    config["exclusive_config_file"] = os.path.join(
        python_skipped_recipe.recipe, "recipe", "long_config.yaml")
    cnfgr_fdstk.render_appveyor(jinja_env=jinja_env,
                                forge_config=config,
                                forge_dir=python_skipped_recipe.recipe)
    # this configuration should be skipped
    assert python_skipped_recipe.config["appveyor"]["enabled"]

    matrix_dir = os.path.join(python_skipped_recipe.recipe, ".ci_support")
    # matrix has 2.7, 3.5, 3.6, but 3.6 is skipped.  Should be 2 entries.
    assert len(os.listdir(matrix_dir)) == 2
def test_upload_on_branch_appveyor(upload_on_branch_recipe, jinja_env):
    cnfgr_fdstk.render_appveyor(jinja_env=jinja_env,
                                forge_config=upload_on_branch_recipe.config,
                                forge_dir=upload_on_branch_recipe.recipe)
    # Check that the parameter is in the configuration.
    assert 'upload_on_branch' in upload_on_branch_recipe.config
    assert upload_on_branch_recipe.config['upload_on_branch'] == 'foo-branch'

    # Check that the parameter is in the generated file.
    with open(os.path.join(upload_on_branch_recipe.recipe,
                           '.appveyor.yml')) as fp:
        content = yaml.load(fp)
    assert '%APPVEYOR_REPO_BRANCH%' in content['deploy_script'][0]
    assert 'UPLOAD_ON_BRANCH=foo-branch' in content['deploy_script'][1]