def test_prepare(workspace, mocker): config = Config({ 'file': 'fake.py', 'files': [str(workspace.readme)], 'prepare': { 'part': Version.PATCH, 'suffix': 'dev', } }) 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.prepare() assert not commit.called assert not tag.called assert hook.prepare.called for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert '1.2.4.dev' in content assert '1.2.3' not in content
def test_prepare(workspace, mocker): config = Config({ "file": "fake.py", "files": [str(workspace.readme)], "prepare": { "part": Version.PATCH, "suffix": "dev", }, }) 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.prepare() assert not commit.called assert not tag.called assert hook.prepare.called for file in workspace.module, workspace.readme: with file.open() as f: content = f.read() assert "1.2.4.dev" in content assert "1.2.3" not in content
def test_prepare(self): with workspace('fake', '1.2.3') as wksp: config = Config({ 'file': 'fake.py', 'files': [wksp.readme], 'prepare': { 'part': Version.PATCH, 'suffix': 'dev', } }) releaser = Releaser(config) with patch.object(releaser, 'commit') as commit: with patch.object(releaser, 'tag') as tag: releaser.prepare() 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.4.dev', content) self.assertNotIn('1.2.3', content)
def test_prepare(self): with workspace('fake', '1.2.3') as wksp: config = Config({ 'file': 'fake.py', 'files': [wksp.readme], 'prepare': { 'part': Version.PATCH, 'suffix': 'dev', } }) releaser = Releaser(config) with patch.object(releaser, 'commit') as commit: with patch.object(releaser, 'tag') as tag: releaser.prepare() 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.4.dev', content) self.assertNotIn('1.2.3', content)
def test_prepare_vcs(self, workspace): config = Config({ 'file': 'fake.py', 'files': [workspace.readme_filename], 'vcs': 'fake', 'prepare': { 'part': Version.PATCH, 'suffix': 'dev', } }) releaser = Releaser(config) with patch.object(releaser, 'commit') as commit: with patch.object(releaser, 'tag') as tag: releaser.prepare() assert commit.call_count, 1 assert not tag.called for filename in workspace.module_filename, workspace.readme_filename: with open(filename) as f: content = f.read() assert '1.2.4.dev' in content assert '1.2.3' not in content