def test_tag_annotate(self, mocker): git = Git() execute = mocker.patch.object(git, 'execute') git.tag('fake', annotation='some annotation') execute.assert_called_with( ['git', 'tag', 'fake', '--annotate', '-m', '"some annotation"'])
def test_validate_ko_not_git(self, workspace, mocker): git = Git() execute = mocker.patch('bumpr.vcs.execute') with pytest.raises(BumprError): git.validate() assert execute.called is False
def test_push(self, mocker): git = Git() execute = mocker.patch.object(git, "execute") git.push() execute.assert_any_call(["git", "push"]) execute.assert_any_call(["git", "push", "--tags"])
def test_push(self, mocker): git = Git() execute = mocker.patch.object(git, 'execute') git.push() execute.assert_any_call(['git', 'push']) execute.assert_any_call(['git', 'push', '--tags'])
def test_commit(self): git = Git() with patch.object(git, 'execute') as execute: git.commit('message') execute.assert_called_with( ['git', 'commit', '-am', 'message'.encode('utf8')])
def test_tag_annotate(self, mocker): git = Git() execute = mocker.patch.object(git, "execute") git.tag("fake", annotation="some annotation") execute.assert_called_with( ["git", "tag", "fake", "--annotate", "-m", '"some annotation"'])
def test_validate_ko_not_git(self, workspace): git = Git() with patch('bumpr.vcs.execute') as execute: with pytest.raises(BumprError): git.validate() assert execute.called is False
def test_push(self): git = Git() with patch.object(git, 'execute') as execute: git.push() execute.assert_any_call(['git', 'push']) execute.assert_any_call(['git', 'push', '--tags'])
def test_validate_ok(self, workspace, mocker): workspace.mkdir(".git") git = Git() execute = mocker.patch("bumpr.vcs.execute") execute.return_value = "?? new.py" git.validate() execute.assert_called_with("git status --porcelain", verbose=False)
def test_validate_ko_not_git(self): with workspace('git'): git = Git() with patch('bumpr.vcs.execute') as execute: with self.assertRaises(BumprError): git.validate() self.assertFalse(execute.called)
def test_validate_ok(self, workspace, mocker): workspace.mkdir('.git') git = Git() execute = mocker.patch('bumpr.vcs.execute') execute.return_value = '?? new.py' git.validate() execute.assert_called_with('git status --porcelain', verbose=False)
def test_validate_ok(self, workspace): workspace.mkdir('.git') git = Git() with patch('bumpr.vcs.execute') as execute: execute.return_value = '?? new.py' git.validate() execute.assert_called_with('git status --porcelain', verbose=False)
def test_validate_ko_not_git(self): with workspace('git') as wksp: git = Git() with patch('bumpr.vcs.execute') as execute: with self.assertRaises(BumprError): git.validate() self.assertFalse(execute.called)
def test_validate_not_clean_dryrun(self, workspace, mocker): workspace.mkdir(".git") git = Git() execute = mocker.patch("bumpr.vcs.execute") execute.return_value = "\n".join((" M modified.py", "?? new.py")) git.validate(dryrun=True) execute.assert_called_with("git status --porcelain", verbose=False)
def test_validate_not_clean_dryrun(self, workspace, mocker): workspace.mkdir('.git') git = Git() execute = mocker.patch('bumpr.vcs.execute') execute.return_value = '\n'.join((' M modified.py', '?? new.py')) git.validate(dryrun=True) execute.assert_called_with('git status --porcelain', verbose=False)
def test_validate_ko_not_clean(self, workspace): workspace.mkdir('.git') git = Git() with patch('bumpr.vcs.execute') as execute: execute.return_value = '\n'.join((' M modified.py', '?? new.py')) with pytest.raises(BumprError): git.validate() execute.assert_called_with('git status --porcelain', verbose=False)
def test_validate_ok(self): with workspace('git') as wksp: os.mkdir('.git') git = Git() with patch('bumpr.vcs.execute') as execute: execute.return_value = '?? new.py' git.validate() execute.assert_called_with('git status --porcelain', verbose=False)
def test_validate_ko_not_clean(self): with workspace('git') as wksp: os.mkdir('.git') git = Git() with patch('bumpr.vcs.execute') as execute: execute.return_value = '\n'.join( (' M modified.py', '?? new.py')) with self.assertRaises(BumprError): git.validate() execute.assert_called_with('git status --porcelain', verbose=False)
def test_tag(self): git = Git() with patch.object(git, 'execute') as execute: git.tag('fake') execute.assert_called_with(['git', 'tag', 'fake'])
def test_tag_annotate(self, mocker): git = Git() execute = mocker.patch.object(git, 'execute') git.tag('fake', annotation='some annotation') execute.assert_called_with(['git', 'tag', 'fake', '--annotate', '-m', '"some annotation"'])
def test_tag(self, mocker): git = Git() execute = mocker.patch.object(git, "execute") git.tag("fake") execute.assert_called_with(["git", "tag", "fake"])
def test_tag(self, mocker): git = Git() execute = mocker.patch.object(git, 'execute') git.tag('fake') execute.assert_called_with(['git', 'tag', 'fake'])
def test_commit(self, mocker): git = Git() execute = mocker.patch.object(git, "execute") git.commit("message") execute.assert_called_with(["git", "commit", "-am", "message"])
def test_commit(self, mocker): git = Git() execute = mocker.patch.object(git, 'execute') git.commit('message') execute.assert_called_with(['git', 'commit', '-am', 'message'])
def test_commit(self): git = Git() with patch.object(git, 'execute') as execute: git.commit('message') execute.assert_called_with(['git', 'commit', '-am', 'message'])