Ejemplo n.º 1
0
def log(range, style, tag_match, before, after, reverse, output):
    """
    Run tidy log output against a range of commits.

    If ``:github/pr`` is provided as the range, the base branch of the pull
    request will be used as the revision range (e.g. ``origin/develop..``).
    If ``:github/pr`` is used as the output target, the log will be written
    as a comment on the current Github pull request.
    """
    range = ' '.join(range)
    core.log(
        range,
        style=style,
        tag_match=tag_match,
        before=before,
        after=after,
        reverse=reverse,
        output=output or sys.stdout,
    )
Ejemplo n.º 2
0
def test_log_no_template(style, expected_exception):
    """
    Tests core.log() when no template is present. The default tidy template
    should be used when the default style is provided
    """
    os.remove('.git-tidy/log.tpl')
    with expected_exception:
        rendered = core.log(style=style)

        assert '# v1.2' not in rendered  # dev1.2 takes precedence in this case
        assert '# dev1.2' in rendered
        assert '# v1.1' in rendered
        assert 'Unreleased' in rendered
        assert 'Description1' in rendered
        assert 'Summary1' in rendered
Ejemplo n.º 3
0
def test_log(output, mocker):
    """Tests core.log() with various output targets"""
    patched_github = mocker.patch('tidy.github.comment', autospec=True)
    rendered = core.log(output=output)

    if isinstance(output, str) and output != ':github/pr':
        with open(output) as f:
            rendered = f.read()
    elif output == ':github/pr':
        assert patched_github.called
    elif output is not None:
        rendered = output.getvalue()

    assert rendered.startswith('# Unreleased')
    assert 'Commit could not be parsed' in rendered
    assert '# dev1.2 (' in rendered
    assert '## Api-Break' in rendered