def test_git_release_with_remote(self):
with git_bare_repo() as bare_repo:
with temp_directory():
with open('VERSION', 'w') as fp:
fp.write('1.0.0\n')
repo = Repo.init()
repo.index.add(['VERSION'])
repo.index.commit('Initial commit')
repo.create_remote('origin', url=bare_repo)
repo.remotes.origin.push(repo.refs.master)
result = self.runner.invoke(release, ['2.0.0'])
self.assertIsNone(result.exception)
self.assertEqual(result.exit_code, 0)
with open('VERSION') as fp:
self.assertEqual(fp.read(), '2.0.0\n')
self.assertEqual(repo.refs.master.commit.message, 'Release 2.0.0')
self.assertEqual(repo.tags['2.0.0'].commit, repo.refs.master.commit)
self.assertFalse(repo.is_dirty())
bare_repo = Repo(bare_repo)
self.assertEqual(bare_repo.commit('master').message, 'Release 2.0.0')
self.assertEqual(bare_repo.tags['2.0.0'].commit, bare_repo.refs.master.commit)
评论列表
文章目录