def test_diff_no_newline(): """ If a file ends without a newline git represents this with the additional line \\ No newline at end of file in diffs. This test asserts these additional lines are parsed correctly. """ gr = GitRepository('test-repos/no_newline') diff = gr.get_commit('52a78c1ee5d100528eccba0a3d67371dbd22d898').modifications[0].diff parsed_lines = gr.parse_diff(diff) added = parsed_lines['added'] deleted = parsed_lines['deleted'] assert (1, 'test1') in deleted # is considered as deleted as a 'newline' command is added assert (1, 'test1') in added # now with added 'newline' assert (2, 'test2') in added gr.clear()
def git_repo(request): gr = GitRepository(request.param) yield gr gr.clear()
def modification(commit): gr = GitRepository("test-repos/diff") yield gr.get_commit(commit).modifications[0] gr.clear()
def git_repo(path): gr = GitRepository(path) yield gr gr.clear()
def modification(request): path, commit = request.param gr = GitRepository(path) yield gr.get_commit(commit).modifications[0] gr.clear()
def repo(): gr = GitRepository('test-repos/small_repo') yield gr gr.clear()