Example #1
0
    def test_tag_annotate(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.tag('fake', annotation='some annotation')
        execute.assert_called_with(
            ['git', 'tag', 'fake', '--annotate', '-m', '"some annotation"'])
Example #2
0
    def test_validate_ko_not_git(self, workspace, mocker):
        git = Git()

        execute = mocker.patch('bumpr.vcs.execute')
        with pytest.raises(BumprError):
            git.validate()
        assert execute.called is False
Example #3
0
    def test_push(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, "execute")
        git.push()
        execute.assert_any_call(["git", "push"])
        execute.assert_any_call(["git", "push", "--tags"])
Example #4
0
    def test_push(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.push()
        execute.assert_any_call(['git', 'push'])
        execute.assert_any_call(['git', 'push', '--tags'])
Example #5
0
    def test_commit(self):
        git = Git()

        with patch.object(git, 'execute') as execute:
            git.commit('message')
            execute.assert_called_with(
                ['git', 'commit', '-am', 'message'.encode('utf8')])
Example #6
0
    def test_tag_annotate(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, "execute")
        git.tag("fake", annotation="some annotation")
        execute.assert_called_with(
            ["git", "tag", "fake", "--annotate", "-m", '"some annotation"'])
Example #7
0
    def test_validate_ko_not_git(self, workspace):
        git = Git()

        with patch('bumpr.vcs.execute') as execute:
            with pytest.raises(BumprError):
                git.validate()
            assert execute.called is False
Example #8
0
    def test_push(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.push()
        execute.assert_any_call(['git', 'push'])
        execute.assert_any_call(['git', 'push', '--tags'])
Example #9
0
    def test_push(self):
        git = Git()

        with patch.object(git, 'execute') as execute:
            git.push()
            execute.assert_any_call(['git', 'push'])
            execute.assert_any_call(['git', 'push', '--tags'])
Example #10
0
    def test_validate_ok(self, workspace, mocker):
        workspace.mkdir(".git")
        git = Git()

        execute = mocker.patch("bumpr.vcs.execute")
        execute.return_value = "?? new.py"
        git.validate()
        execute.assert_called_with("git status --porcelain", verbose=False)
Example #11
0
    def test_validate_ko_not_git(self):
        with workspace('git'):
            git = Git()

            with patch('bumpr.vcs.execute') as execute:
                with self.assertRaises(BumprError):
                    git.validate()
                self.assertFalse(execute.called)
Example #12
0
    def test_validate_ok(self, workspace, mocker):
        workspace.mkdir('.git')
        git = Git()

        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '?? new.py'
        git.validate()
        execute.assert_called_with('git status --porcelain', verbose=False)
Example #13
0
    def test_validate_ok(self, workspace):
        workspace.mkdir('.git')
        git = Git()

        with patch('bumpr.vcs.execute') as execute:
            execute.return_value = '?? new.py'
            git.validate()
            execute.assert_called_with('git status --porcelain', verbose=False)
Example #14
0
    def test_validate_ko_not_git(self):
        with workspace('git') as wksp:
            git = Git()

            with patch('bumpr.vcs.execute') as execute:
                with self.assertRaises(BumprError):
                    git.validate()
                self.assertFalse(execute.called)
Example #15
0
    def test_validate_not_clean_dryrun(self, workspace, mocker):
        workspace.mkdir(".git")
        git = Git()
        execute = mocker.patch("bumpr.vcs.execute")
        execute.return_value = "\n".join((" M modified.py", "?? new.py"))

        git.validate(dryrun=True)

        execute.assert_called_with("git status --porcelain", verbose=False)
Example #16
0
    def test_validate_not_clean_dryrun(self, workspace, mocker):
        workspace.mkdir('.git')
        git = Git()
        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '\n'.join((' M modified.py', '?? new.py'))

        git.validate(dryrun=True)

        execute.assert_called_with('git status --porcelain', verbose=False)
Example #17
0
    def test_validate_ko_not_clean(self, workspace):
        workspace.mkdir('.git')
        git = Git()

        with patch('bumpr.vcs.execute') as execute:
            execute.return_value = '\n'.join((' M modified.py', '?? new.py'))
            with pytest.raises(BumprError):
                git.validate()
            execute.assert_called_with('git status --porcelain', verbose=False)
Example #18
0
    def test_validate_not_clean_dryrun(self, workspace, mocker):
        workspace.mkdir('.git')
        git = Git()
        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '\n'.join((' M modified.py', '?? new.py'))

        git.validate(dryrun=True)

        execute.assert_called_with('git status --porcelain', verbose=False)
Example #19
0
    def test_validate_ok(self):
        with workspace('git') as wksp:
            os.mkdir('.git')
            git = Git()

            with patch('bumpr.vcs.execute') as execute:
                execute.return_value = '?? new.py'
                git.validate()
                execute.assert_called_with('git status --porcelain',
                                           verbose=False)
Example #20
0
    def test_validate_ko_not_clean(self):
        with workspace('git') as wksp:
            os.mkdir('.git')
            git = Git()

            with patch('bumpr.vcs.execute') as execute:
                execute.return_value = '\n'.join(
                    (' M modified.py', '?? new.py'))
                with self.assertRaises(BumprError):
                    git.validate()
                execute.assert_called_with('git status --porcelain',
                                           verbose=False)
Example #21
0
    def test_tag(self):
        git = Git()

        with patch.object(git, 'execute') as execute:
            git.tag('fake')
            execute.assert_called_with(['git', 'tag', 'fake'])
Example #22
0
    def test_tag_annotate(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.tag('fake', annotation='some annotation')
        execute.assert_called_with(['git', 'tag', 'fake', '--annotate', '-m', '"some annotation"'])
Example #23
0
    def test_tag(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, "execute")
        git.tag("fake")
        execute.assert_called_with(["git", "tag", "fake"])
Example #24
0
    def test_tag(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.tag('fake')
        execute.assert_called_with(['git', 'tag', 'fake'])
Example #25
0
    def test_commit(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, "execute")
        git.commit("message")
        execute.assert_called_with(["git", "commit", "-am", "message"])
Example #26
0
    def test_tag(self):
        git = Git()

        with patch.object(git, 'execute') as execute:
            git.tag('fake')
            execute.assert_called_with(['git', 'tag', 'fake'])
Example #27
0
    def test_commit(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.commit('message')
        execute.assert_called_with(['git', 'commit', '-am', 'message'])
Example #28
0
    def test_commit(self):
        git = Git()

        with patch.object(git, 'execute') as execute:
            git.commit('message')
            execute.assert_called_with(['git', 'commit', '-am', 'message'])
Example #29
0
    def test_tag(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.tag('fake')
        execute.assert_called_with(['git', 'tag', 'fake'])
Example #30
0
    def test_commit(self, mocker):
        git = Git()

        execute = mocker.patch.object(git, 'execute')
        git.commit('message')
        execute.assert_called_with(['git', 'commit', '-am', 'message'])