Example #1
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')])
Example #2
0
    def test_validate_ko_not_mercurial(self, workspace):
        mercurial = Mercurial()

        with patch('bumpr.vcs.execute') as execute:
            with pytest.raises(BumprError):
                mercurial.validate()
            assert execute.called is False
Example #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"'])
Example #4
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
Example #5
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"'])
Example #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)
Example #7
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)
Example #8
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)
Example #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)
Example #10
0
    def test_validate_ok(self, workspace):
        workspace.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)
Example #11
0
    def test_validate_ko_not_mercurial(self):
        with workspace('mercurial'):
            mercurial = Mercurial()

            with patch('bumpr.vcs.execute') as execute:
                with self.assertRaises(BumprError):
                    mercurial.validate()
                self.assertFalse(execute.called)
Example #12
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)
Example #13
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)
Example #14
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)
Example #15
0
    def test_validate_ko_not_clean(self, workspace):
        workspace.mkdir('.hg')
        mercurial = Mercurial()

        with patch('bumpr.vcs.execute') as execute:
            execute.return_value = '\n'.join((' M modified.py', '?? new.py'))
            with pytest.raises(BumprError):
                mercurial.validate()
            execute.assert_called_with('hg status -mard', verbose=False)
Example #16
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)
Example #17
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'])
Example #18
0
    def test_tag(self):
        mercurial = Mercurial()

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

        execute = mocker.patch.object(mercurial, "execute")
        mercurial.push()
        execute.assert_called_with(["hg", "push"])
Example #20
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"])
Example #21
0
    def test_push(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.push()
        execute.assert_called_with(['hg', 'push'])
Example #22
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'])
Example #23
0
    def test_tag(self, mocker):
        mercurial = Mercurial()

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

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.tag('fake')
        execute.assert_called_with(['hg', 'tag', 'fake'])
Example #25
0
    def test_tag(self, mocker):
        mercurial = Mercurial()

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

        with patch.object(mercurial, 'execute') as execute:
            mercurial.push()
            execute.assert_called_with(['hg', 'push'])
Example #27
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'])
Example #28
0
    def test_push(self, mocker):
        mercurial = Mercurial()

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.push()
        execute.assert_called_with(['hg', 'push'])
Example #29
0
    def test_tag(self):
        mercurial = Mercurial()

        with patch.object(mercurial, 'execute') as execute:
            mercurial.tag('fake')
            execute.assert_called_with(['hg', 'tag', 'fake'])
Example #30
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"'])