Beispiel #1
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
Beispiel #2
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
Beispiel #3
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)
Beispiel #4
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)
Beispiel #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)
Beispiel #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)
Beispiel #7
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)
Beispiel #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)
Beispiel #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)
Beispiel #10
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)
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
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)