Ejemplo n.º 1
0
    def test_commit(self):
        bazaar = Bazaar()

        with patch.object(bazaar, 'execute') as execute:
            bazaar.commit('message')
            execute.assert_called_with(
                ['bzr', 'commit', '-m', 'message'.encode('utf8')])
Ejemplo n.º 2
0
    def test_validate_ko_not_bazaar(self, workspace, mocker):
        bazaar = Bazaar()

        execute = mocker.patch('bumpr.vcs.execute')
        with pytest.raises(BumprError):
            bazaar.validate()
        assert execute.called is False
Ejemplo n.º 3
0
    def test_validate_ko_not_bazaar(self, workspace):
        bazaar = Bazaar()

        with patch('bumpr.vcs.execute') as execute:
            with pytest.raises(BumprError):
                bazaar.validate()
            assert execute.called is False
Ejemplo n.º 4
0
    def test_validate_ok(self, workspace, mocker):
        workspace.mkdir('.bzr')
        bazaar = Bazaar()

        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '? new.py'
        bazaar.validate()
        execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 5
0
    def test_validate_ko_not_bazaar(self):
        with workspace('bazaar') as wksp:
            bazaar = Bazaar()

            with patch('bumpr.vcs.execute') as execute:
                with self.assertRaises(BumprError):
                    bazaar.validate()
                self.assertFalse(execute.called)
Ejemplo n.º 6
0
    def test_validate_ok(self, workspace):
        workspace.mkdir('.bzr')
        bazaar = Bazaar()

        with patch('bumpr.vcs.execute') as execute:
            execute.return_value = '? new.py'
            bazaar.validate()
            execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 7
0
    def test_validate_ko_not_bazaar(self):
        with workspace('bazaar'):
            bazaar = Bazaar()

            with patch('bumpr.vcs.execute') as execute:
                with self.assertRaises(BumprError):
                    bazaar.validate()
                self.assertFalse(execute.called)
Ejemplo n.º 8
0
    def test_validate_ok(self, workspace, mocker):
        workspace.mkdir(".bzr")
        bazaar = Bazaar()

        execute = mocker.patch("bumpr.vcs.execute")
        execute.return_value = "? new.py"
        bazaar.validate()
        execute.assert_called_with("bzr status --short", verbose=False)
Ejemplo n.º 9
0
    def test_validate_ko_not_clean(self, workspace, mocker):
        workspace.mkdir('.bzr')
        bazaar = Bazaar()

        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '\n'.join((' M modified.py', '? new.py'))
        with pytest.raises(BumprError):
            bazaar.validate()
        execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 10
0
    def test_validate_ko_not_clean(self, workspace, mocker):
        workspace.mkdir(".bzr")
        bazaar = Bazaar()

        execute = mocker.patch("bumpr.vcs.execute")
        execute.return_value = "\n".join((" M modified.py", "? new.py"))
        with pytest.raises(BumprError):
            bazaar.validate()
        execute.assert_called_with("bzr status --short", verbose=False)
Ejemplo n.º 11
0
    def test_validate_ok(self):
        with workspace('bazaar') as wksp:
            os.mkdir('.bzr')
            bazaar = Bazaar()

            with patch('bumpr.vcs.execute') as execute:
                execute.return_value = '? new.py'
                bazaar.validate()
                execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 12
0
    def test_validate_ko_not_clean(self, workspace):
        workspace.mkdir('.bzr')
        bazaar = Bazaar()

        with patch('bumpr.vcs.execute') as execute:
            execute.return_value = '\n'.join((' M modified.py', '? new.py'))
            with pytest.raises(BumprError):
                bazaar.validate()
            execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 13
0
    def test_validate_not_clean_dryrun(self, workspace, mocker):
        workspace.mkdir('.bzr')
        bazaar = Bazaar()

        execute = mocker.patch('bumpr.vcs.execute')
        execute.return_value = '\n'.join((' M modified.py', '? new.py'))

        bazaar.validate(dryrun=True)

        execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 14
0
    def test_validate_ko_not_clean(self):
        with workspace('bazaar') as wksp:
            os.mkdir('.bzr')
            bazaar = Bazaar()

            with patch('bumpr.vcs.execute') as execute:
                execute.return_value = '\n'.join(
                    (' M modified.py', '? new.py'))
                with self.assertRaises(BumprError):
                    bazaar.validate()
                execute.assert_called_with('bzr status --short', verbose=False)
Ejemplo n.º 15
0
    def test_tag_annotate(self, mocker, caplog):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.tag('fake', annotation='some annotation')
        execute.assert_called_with(['bzr', 'tag', 'fake'])

        record = caplog.record_tuples[0]

        assert record[0] == 'bumpr.vcs'
        assert record[1] == logging.WARNING
Ejemplo n.º 16
0
    def test_tag_annotate(self, mocker, caplog):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.tag('fake', annotation='some annotation')
        execute.assert_called_with(['bzr', 'tag', 'fake'])

        record = caplog.record_tuples[0]

        assert record[0] == 'bumpr.vcs'
        assert record[1] == logging.WARNING
Ejemplo n.º 17
0
    def test_tag_annotate(self, mocker, caplog):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, "execute")
        bazaar.tag("fake", annotation="some annotation")
        execute.assert_called_with(["bzr", "tag", "fake"])

        record = caplog.record_tuples[0]

        assert record[0] == "bumpr.vcs"
        assert record[1] == logging.WARNING
Ejemplo n.º 18
0
    def test_commit(self, mocker):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, "execute")
        bazaar.commit("message")
        execute.assert_called_with(["bzr", "commit", "-m", "message"])
Ejemplo n.º 19
0
    def test_tag(self):
        bazaar = Bazaar()

        with patch.object(bazaar, 'execute') as execute:
            bazaar.tag('fake')
            execute.assert_called_with(['bzr', 'tag', 'fake'])
Ejemplo n.º 20
0
    def test_push(self, mocker):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, "execute")
        bazaar.push()
        execute.assert_called_with(["bzr", "push"])
Ejemplo n.º 21
0
    def test_push(self, mocker):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.push()
        execute.assert_called_with(['bzr', 'push'])
Ejemplo n.º 22
0
    def test_commit(self):
        bazaar = Bazaar()

        with patch.object(bazaar, 'execute') as execute:
            bazaar.commit('message')
            execute.assert_called_with(['bzr', 'commit', '-m', 'message'])
Ejemplo n.º 23
0
    def test_tag(self, mocker, caplog):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.tag('fake')
        execute.assert_called_with(['bzr', 'tag', 'fake'])
Ejemplo n.º 24
0
    def test_commit(self, mocker):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.commit('message')
        execute.assert_called_with(['bzr', 'commit', '-m', 'message'])
Ejemplo n.º 25
0
    def test_tag(self, mocker, caplog):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, "execute")
        bazaar.tag("fake")
        execute.assert_called_with(["bzr", "tag", "fake"])
Ejemplo n.º 26
0
    def test_push(self, mocker):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.push()
        execute.assert_called_with(['bzr', 'push'])
Ejemplo n.º 27
0
    def test_tag(self):
        bazaar = Bazaar()

        with patch.object(bazaar, 'execute') as execute:
            bazaar.tag('fake')
            execute.assert_called_with(['bzr', 'tag', 'fake'])
Ejemplo n.º 28
0
    def test_commit(self, mocker):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.commit('message')
        execute.assert_called_with(['bzr', 'commit', '-m', 'message'])
Ejemplo n.º 29
0
    def test_push(self):
        bazaar = Bazaar()

        with patch.object(bazaar, 'execute') as execute:
            bazaar.push()
            execute.assert_called_with(['bzr', 'push'])
Ejemplo n.º 30
0
    def test_tag(self, mocker, caplog):
        bazaar = Bazaar()

        execute = mocker.patch.object(bazaar, 'execute')
        bazaar.tag('fake')
        execute.assert_called_with(['bzr', 'tag', 'fake'])