def test_make_repo_starting_empty():
    make_repo(
        '.', 'ruby', 'scss-lint', r'\.scss$', 'scss-lint',
        version_list_fn_map={'ruby': returns_some_versions},
    )

    # Assert that our things got copied over
    assert os.path.exists('hooks.yaml')
    assert os.path.exists('__fake_gem.gemspec')
    # Assert that we set the version fiel correctly
    assert os.path.exists('.version')
    assert io.open('.version').read() == '0.24.1'

    # Assert some things about hte gits
    assert get_output('git', 'status', '-s').strip() == ''
    assert get_output('git', 'tag', '-l').strip().split() == [
        'v0.23.1', 'v0.24.0', 'v0.24.1',
    ]
    log_lines = get_output('git', 'log', '--oneline').strip().splitlines()
    log_lines_split = [log_line.split() for log_line in log_lines]
    assert log_lines_split == [
        [mock.ANY, 'Mirror:', '0.24.1'],
        [mock.ANY, 'Mirror:', '0.24.0'],
        [mock.ANY, 'Mirror:', '0.23.1'],
    ]
def test_python_integration():
    make_repo('.', 'python', 'flake8', r'\.py$', 'flake8')
    # Our files should exist
    assert os.path.exists('.version')
    assert os.path.exists('hooks.yaml')
    assert os.path.exists('setup.py')

    # Should have _some_ tags
    assert get_output('git', 'tag', '-l').strip()
    # Should have _some_ commits
    assert get_output('git', 'log', '--oneline').strip()
def test_node_integration():
    make_repo('.', 'node', 'jshint', r'\.js$', 'jshint')
    # Our files should exist
    assert os.path.exists('.version')
    assert os.path.exists('hooks.yaml')
    assert os.path.exists('package.json')

    # Should have made _some_ tags
    assert get_output('git', 'tag', '-l').strip()
    # Should have made _some_ commits
    assert get_output('git', 'log', '--oneline').strip()
def test_ruby_integration():
    make_repo('.', 'ruby', 'scss-lint', r'\.scss$', 'scss-lint')
    # Our files should exist
    assert os.path.exists('.version')
    assert os.path.exists('hooks.yaml')
    assert os.path.exists('__fake_gem.gemspec')

    # Should have made _some_ tags
    assert get_output('git', 'tag', '-l').strip()
    # Should have made _some_ commits
    assert get_output('git', 'log', '--oneline').strip()
def test_apply_version_and_commit():
    _apply_version_and_commit(
        '0.24.1', 'ruby', 'scss-lint', r'\.scss$', 'scss-lint',
    )

    # Assert that our things got copied over
    assert os.path.exists('hooks.yaml')
    assert os.path.exists('__fake_gem.gemspec')
    # Assert that we set the version file correctly
    assert os.path.exists('.version')
    assert io.open('.version').read() == '0.24.1'

    # Assert some things about the gits
    assert get_output('git', 'status', '-s').strip() == ''
    assert get_output('git', 'tag', '-l').strip() == 'v0.24.1'
    assert get_output('git', 'log', '--oneline').strip().split() == [
        mock.ANY, 'Mirror:', '0.24.1',
    ]
def test_make_repo_starting_at_version():
    # Write a version file (as if we've already run this before)
    with io.open('.version', 'w') as version_file:
        version_file.write('0.23.1')

    make_repo(
        '.', 'ruby', 'scss-lint', r'\.scss$', 'scss-lint',
        version_list_fn_map={'ruby': returns_some_versions},
    )

    # Assert that we only got tags / commits for the stuff we added
    assert get_output('git', 'tag', '-l').strip().split() == [
        'v0.24.0', 'v0.24.1',
    ]
    log_lines = get_output('git', 'log', '--oneline').strip().splitlines()
    log_lines_split = [log_line.split() for log_line in log_lines]
    assert log_lines_split == [
        [mock.ANY, 'Mirror:', '0.24.1'],
        [mock.ANY, 'Mirror:', '0.24.0'],
    ]
Ejemplo n.º 7
0
def node_get_package_versions(package_name):
    output = simplejson.loads(get_output(
        'npm', 'view', package_name, '--json',
    ))
    return output['versions']
Ejemplo n.º 8
0
def test_get_output():
    output = get_output('echo', 'hi')
    assert output == 'hi\n'