示例#1
0
    def test_validate_ko_not_mercurial(self, workspace, mocker):
        mercurial = Mercurial()

        execute = mocker.patch('bumpr.vcs.execute')
        with pytest.raises(BumprError):
            mercurial.validate()
        assert execute.called is False
示例#2
0
    def test_commit(self):
        mercurial = Mercurial()

        with patch.object(mercurial, 'execute') as execute:
            mercurial.commit('message')
            execute.assert_called_with(
                ['hg', 'commit', '-A', '-m', 'message'.encode('utf8')])
示例#3
0
    def test_tag_annotate(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, "execute")
        mercurial.tag("fake", annotation="some annotation")
        execute.assert_called_with(
            ["hg", "tag", "fake", "-m", '"some annotation"'])
示例#4
0
    def test_tag_annotate(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.tag('fake', annotation='some annotation')
        execute.assert_called_with(
            ['hg', 'tag', 'fake', '-m', '"some annotation"'])
示例#5
0
    def test_validate_ok(self, workspace, mocker):
        workspace.mkdir(".hg")
        mercurial = Mercurial()

        execute = mocker.patch("bumpr.vcs.execute")
        execute.return_value = "?? new.py"
        mercurial.validate()
        execute.assert_called_with("hg status -mard", verbose=False)
示例#6
0
    def test_validate_not_clean_dryrun(self, workspace, mocker):
        workspace.mkdir(".hg")
        mercurial = Mercurial()

        execute = mocker.patch("bumpr.vcs.execute")
        execute.return_value = "\n".join((" M modified.py", "?? new.py"))
        mercurial.validate(dryrun=True)
        execute.assert_called_with("hg status -mard", verbose=False)
示例#7
0
    def test_validate_not_clean_dryrun(self, workspace, mocker):
        workspace.mkdir('.hg')
        mercurial = Mercurial()

        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '\n'.join((' M modified.py', '?? new.py'))
        mercurial.validate(dryrun=True)
        execute.assert_called_with('hg status -mard', verbose=False)
示例#8
0
    def test_validate_ko_not_mercurial(self):
        with workspace('mercurial') as wksp:
            mercurial = Mercurial()

            with patch('bumpr.vcs.execute') as execute:
                with self.assertRaises(BumprError):
                    mercurial.validate()
                self.assertFalse(execute.called)
示例#9
0
    def test_validate_ok(self, workspace, mocker):
        workspace.mkdir('.hg')
        mercurial = Mercurial()

        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '?? new.py'
        mercurial.validate()
        execute.assert_called_with('hg status -mard', verbose=False)
示例#10
0
    def test_validate_ok(self):
        with workspace('mercurial') as wksp:
            os.mkdir('.hg')
            mercurial = Mercurial()

            with patch('bumpr.vcs.execute') as execute:
                execute.return_value = '?? new.py'
                mercurial.validate()
                execute.assert_called_with('hg status -mard', verbose=False)
示例#11
0
    def test_validate_ko_not_clean(self):
        with workspace('mercurial') as wksp:
            os.mkdir('.hg')
            mercurial = Mercurial()

            with patch('bumpr.vcs.execute') as execute:
                execute.return_value = '\n'.join(
                    (' M modified.py', '?? new.py'))
                with self.assertRaises(BumprError):
                    mercurial.validate()
                execute.assert_called_with('hg status -mard', verbose=False)
示例#12
0
    def test_commit(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, "execute")
        mercurial.commit("message")
        execute.assert_called_with(["hg", "commit", "-A", "-m", "message"])
示例#13
0
    def test_tag(self):
        mercurial = Mercurial()

        with patch.object(mercurial, 'execute') as execute:
            mercurial.tag('fake')
            execute.assert_called_with(['hg', 'tag', 'fake'])
示例#14
0
    def test_push(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.push()
        execute.assert_called_with(['hg', 'push'])
示例#15
0
    def test_commit(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.commit('message')
        execute.assert_called_with(['hg', 'commit', '-A', '-m', 'message'])
示例#16
0
    def test_tag(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, "execute")
        mercurial.tag("fake")
        execute.assert_called_with(["hg", "tag", "fake"])
示例#17
0
    def test_tag(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.tag('fake')
        execute.assert_called_with(['hg', 'tag', 'fake'])
示例#18
0
    def test_push(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, "execute")
        mercurial.push()
        execute.assert_called_with(["hg", "push"])