本文整理汇总了Python中bumpr.releaser.Releaser.prepare方法的典型用法代码示例。如果您正苦于以下问题:Python Releaser.prepare方法的具体用法?Python Releaser.prepare怎么用?Python Releaser.prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bumpr.releaser.Releaser
的用法示例。
在下文中一共展示了Releaser.prepare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_prepare
# 需要导入模块: from bumpr.releaser import Releaser [as 别名]
# 或者: from bumpr.releaser.Releaser import prepare [as 别名]
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
示例2: test_prepare
# 需要导入模块: from bumpr.releaser import Releaser [as 别名]
# 或者: from bumpr.releaser.Releaser import prepare [as 别名]
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)