Пример #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"'])
Пример #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
Пример #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"])
Пример #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'])
Пример #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')])
Пример #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"'])
Пример #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
Пример #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'])
Пример #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'])
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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'])
Пример #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"'])
Пример #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"])
Пример #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'])
Пример #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"])
Пример #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'])
Пример #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'])
Пример #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'])
Пример #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'])
Пример #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'])