예제 #1
0
def meta_generator_helper(data_path):
    # set up
    target_as_dict = safe_yaml_read(path.join(data_path, 'target.meta.yaml'))
    with open(path.join(data_path, 'target.meta.yaml'), 'r') as f:
        target_as_string = f.read()

    skeletor_config_path = path.join(data_path, 'conda-skeletor.yml')
    print('skeletor_config_path: %s' % skeletor_config_path)
    git_url = target_as_dict['source']['git_url']
    git_rev = target_as_dict['source']['git_rev']

    # clone the repo to a temporary directory
    source_dir = git.clone(git_url, git_rev)
    git.checkout(git_rev, source_dir)

    # run tests
    programmatic_path = generate_programmatically(source_dir,
                                                  skeletor_config_path)
    programmatic_yaml_path = os.path.join(programmatic_path, 'meta.yaml')
    assert safe_yaml_read(programmatic_yaml_path) == target_as_dict
    with open(programmatic_yaml_path, 'r') as f:
        programmatic_text = f.read()
    assert programmatic_text == target_as_string

    cli_path = generate_cli_local_source(source_dir, skeletor_config_path)
    cli_yaml_path = os.path.join(cli_path, 'meta.yaml')
    assert safe_yaml_read(cli_yaml_path) == target_as_dict
    with open(cli_yaml_path, 'r') as f:
        cli_text = f.read()
    assert cli_text == target_as_string

    # tear down
    shutil.rmtree(cli_path)
    shutil.rmtree(programmatic_path)
    shutil.rmtree(source_dir)
예제 #2
0
def test_git_clone():
    """Smoketest to make sure an exception isn't thrown on duplicate clone calls
    """
    clone('http://github.com/ericdill/conda-skeletor')
    clone('http://github.com/ericdill/conda-skeletor')