Exemplo n.º 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')])
Exemplo n.º 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
Exemplo n.º 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"'])
Exemplo n.º 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
Exemplo n.º 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"'])
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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'])
Exemplo n.º 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'])
Exemplo n.º 19
0
    def test_push(self, mocker):
        mercurial = Mercurial()

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

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.push()
        execute.assert_called_with(['hg', 'push'])
Exemplo n.º 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'])
Exemplo n.º 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"])
Exemplo n.º 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'])
Exemplo n.º 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'])
Exemplo n.º 26
0
    def test_push(self):
        mercurial = Mercurial()

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

        execute = mocker.patch.object(mercurial, 'execute')
        mercurial.push()
        execute.assert_called_with(['hg', 'push'])
Exemplo n.º 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'])
Exemplo n.º 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"'])