def test_bump(self): with workspace('fake', '1.2.3.dev') as wksp: config = Config({'file': 'fake.py', 'files': [wksp.readme]}) releaser = Releaser(config) with patch.object(releaser, 'commit') as commit: with patch.object(releaser, 'tag') as tag: releaser.bump() self.assertFalse(commit.called) self.assertFalse(tag.called) for filename in wksp.module, wksp.readme: with open(filename) as f: content = f.read() self.assertIn('1.2.3', content) self.assertNotIn('1.2.3.dev', content)
def test_bump_vcs(self, workspace): config = Config({ 'file': 'fake.py', 'files': [workspace.readme_filename], 'vcs': 'fake', }) releaser = Releaser(config) with patch.object(releaser, 'commit') as commit: with patch.object(releaser, 'tag') as tag: releaser.bump() assert commit.call_count == 1 assert tag.called for filename in workspace.module_filename, workspace.readme_filename: with open(filename) as f: content = f.read() assert '1.2.3' in content assert '1.2.3.dev' not in content
def test_bump_vcs(workspace, mocker): config = Config({ 'file': 'fake.py', 'files': [str(workspace.readme)], 'vcs': 'fake', }) releaser = Releaser(config) commit = mocker.patch.object(releaser, 'commit') tag = mocker.patch.object(releaser, 'tag') releaser.bump() assert commit.call_count == 1 assert tag.called for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert '1.2.3' in content assert '1.2.3.dev' not in content
def test_bump_vcs(workspace, mocker): config = Config({ "file": "fake.py", "files": [str(workspace.readme)], "vcs": "fake", }) releaser = Releaser(config) commit = mocker.patch.object(releaser, "commit") tag = mocker.patch.object(releaser, "tag") releaser.bump() assert commit.call_count == 1 assert tag.called for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert "1.2.3" in content assert "1.2.3.dev" not in content
def test_bump_vcs_with_annotation(workspace, mocker): config = Config({ 'file': 'fake.py', 'files': [str(workspace.readme)], 'vcs': 'fake', 'tag_annotation': 'version {version}' }) releaser = Releaser(config) commit = mocker.patch.object(releaser, 'commit') tag = mocker.patch.object(releaser.vcs, 'tag') releaser.bump() assert commit.call_count == 1 tag.assert_called_with(str(releaser.version), 'version {0}'.format(releaser.version)) for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert '1.2.3' in content assert '1.2.3.dev' not in content
def test_bump(self, workspace): config = Config({ 'file': 'fake.py', 'files': [workspace.readme_filename], }) releaser = Releaser(config) hook = MagicMock() with patch.object(releaser, 'hooks', [hook]): with patch.object(releaser, 'commit') as commit: with patch.object(releaser, 'tag') as tag: releaser.bump() assert not commit.called assert not tag.called assert hook.bump.called for filename in workspace.module_filename, workspace.readme_filename: with open(filename) as f: content = f.read() assert '1.2.3' in content assert '1.2.3.dev' not in content
def test_bump_vcs_with_annotation(workspace, mocker): config = Config({ "file": "fake.py", "files": [str(workspace.readme)], "vcs": "fake", "tag_annotation": "version {version}", }) releaser = Releaser(config) commit = mocker.patch.object(releaser, "commit") tag = mocker.patch.object(releaser.vcs, "tag") releaser.bump() assert commit.call_count == 1 tag.assert_called_with(str(releaser.version), "version {0}".format(releaser.version)) for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert "1.2.3" in content assert "1.2.3.dev" not in content
def test_bump(workspace, mocker): config = Config({ 'file': 'fake.py', 'files': [str(workspace.readme)], }) releaser = Releaser(config) hook = mocker.MagicMock() mocker.patch.object(releaser, 'hooks', [hook]) commit = mocker.patch.object(releaser, 'commit') tag = mocker.patch.object(releaser, 'tag') releaser.bump() assert not commit.called assert not tag.called assert hook.bump.called for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert '1.2.3' in content assert '1.2.3.dev' not in content
def test_bump(workspace, mocker): config = Config({ "file": "fake.py", "files": [str(workspace.readme)], }) releaser = Releaser(config) hook = mocker.MagicMock() mocker.patch.object(releaser, "hooks", [hook]) commit = mocker.patch.object(releaser, "commit") tag = mocker.patch.object(releaser, "tag") releaser.bump() assert not commit.called assert not tag.called assert hook.bump.called for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert "1.2.3" in content assert "1.2.3.dev" not in content