File: test_git_abort.py

package info (click to toggle)
git-extras 7.4.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 2,120 kB
  • sloc: sh: 4,312; python: 994; makefile: 146
file content (66 lines) | stat: -rw-r--r-- 2,071 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from git import GitCommandError


class TestGitAbort:
    def test_init(self, temp_repo):
        git = temp_repo.get_repo_git()
        tmp_file = temp_repo.get_file(0)
        git.branch("A")
        git.branch("B")
        git.checkout("A")
        temp_repo.writefile(tmp_file, "a")
        git.add(".")
        git.commit("-m", "A")
        git.checkout("B")
        temp_repo.writefile(tmp_file, "b")
        git.add(".")
        git.commit("-m", "B")
        git.status()

    def test_cherry_pick(self, temp_repo):
        git = temp_repo.get_repo_git()
        try:
            git.cherry_pick("A")
        except GitCommandError as err:
            print(err)
        result = git.status()
        assert "Unmerged path" in result
        temp_repo.invoke_extras_command("abort")
        result = git.status()
        assert "nothing to commit, working tree clean" in result

    def test_merge(self, temp_repo):
        git = temp_repo.get_repo_git()
        try:
            git.merge("A")
        except GitCommandError as err:
            print(err)
        result = git.status()
        assert "Unmerged path" in result
        temp_repo.invoke_extras_command("abort")
        result = git.status()
        assert "nothing to commit, working tree clean" in result

    def test_rebase(self, temp_repo):
        git = temp_repo.get_repo_git()
        try:
            git.rebase("A")
        except GitCommandError as err:
            print(err)
        result = git.status()
        assert "Unmerged path" in result
        temp_repo.invoke_extras_command("abort")
        result = git.status()
        assert "nothing to commit, working tree clean" in result

    def test_revert(self, temp_repo):
        git = temp_repo.get_repo_git()
        try:
            git.revert("A")
        except GitCommandError as err:
            print(err)
        result = git.status()
        assert "Unmerged path" in result
        temp_repo.invoke_extras_command("abort")
        result = git.status()
        assert "nothing to commit, working tree clean" in result