当前位置: 首页>>代码示例>>Python>>正文


Python releaser.Releaser类代码示例

本文整理汇总了Python中bumpr.releaser.Releaser的典型用法代码示例。如果您正苦于以下问题:Python Releaser类的具体用法?Python Releaser怎么用?Python Releaser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Releaser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    import sys
    from bumpr import log
    log.init()

    from bumpr.config import Config, ValidationError
    from bumpr.releaser import Releaser
    from bumpr.helpers import BumprError
    from logging import DEBUG, INFO, getLogger

    config = Config.parse_args()
    getLogger().setLevel(DEBUG if config.verbose else INFO)
    logger = getLogger(__name__)

    try:
        config.validate()
    except ValidationError as e:
        msg = 'Invalid configuration: {0}'.format(e)
        logger.error(msg)
        sys.exit(1)

    try:
        releaser = Releaser(config)
        releaser.release()
    except BumprError as error:
        logger.error(str(error))
        sys.exit(1)
开发者ID:eight04,项目名称:bumpr,代码行数:27,代码来源:__init__.py

示例2: test_prepare

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
开发者ID:noirbizarre,项目名称:bumpr,代码行数:26,代码来源:test_releaser.py

示例3: test_tag_no_tag

def test_tag_no_tag(workspace, mocker):
    config = Config({'file': 'fake.py', 'vcs': 'fake', 'tag': False})
    releaser = Releaser(config)
    vcs = mocker.patch.object(releaser, 'vcs')

    releaser.tag()

    assert not vcs.tag.called
开发者ID:noirbizarre,项目名称:bumpr,代码行数:8,代码来源:test_releaser.py

示例4: test_commit_no_commit

def test_commit_no_commit(workspace, mocker):
    config = Config({'file': 'fake.py', 'vcs': 'fake', 'commit': False})
    releaser = Releaser(config)
    vcs = mocker.patch.object(releaser, 'vcs')

    releaser.commit('message')

    assert not vcs.commit.called
开发者ID:noirbizarre,项目名称:bumpr,代码行数:8,代码来源:test_releaser.py

示例5: test_tag

def test_tag(workspace, mocker):
    config = Config({'file': 'fake.py', 'vcs': 'fake'})
    releaser = Releaser(config)
    vcs = mocker.patch.object(releaser, 'vcs')

    releaser.tag()

    vcs.tag.assert_called_with(str(releaser.version))
开发者ID:noirbizarre,项目名称:bumpr,代码行数:8,代码来源:test_releaser.py

示例6: test_push_disabled_by_default

def test_push_disabled_by_default(workspace, mocker):
    config = Config({'file': 'fake.py', 'vcs': 'fake'})
    releaser = Releaser(config)
    vcs = mocker.patch.object(releaser, 'vcs')

    releaser.push()

    assert not vcs.push.called
开发者ID:noirbizarre,项目名称:bumpr,代码行数:8,代码来源:test_releaser.py

示例7: test_commit

def test_commit(workspace, mocker):
    config = Config({'file': 'fake.py', 'vcs': 'fake'})
    releaser = Releaser(config)
    vcs = mocker.patch.object(releaser, 'vcs')

    releaser.commit('message')

    vcs.commit.assert_called_with('message')
开发者ID:noirbizarre,项目名称:bumpr,代码行数:8,代码来源:test_releaser.py

示例8: test_push_no_commit

def test_push_no_commit(workspace, mocker):
    config = Config({'file': 'fake.py', 'vcs': 'fake', 'push': True, 'commit': False})
    releaser = Releaser(config)
    vcs = mocker.patch.object(releaser, 'vcs')

    releaser.push()

    assert not vcs.push.called
开发者ID:noirbizarre,项目名称:bumpr,代码行数:8,代码来源:test_releaser.py

示例9: test_clean

    def test_clean(self):
        config = Config({
            'file': 'fake.py',
            'clean': 'clean command',
        })
        with workspace('fake'):
            releaser = Releaser(config)

        with patch('bumpr.releaser.execute') as execute:
            releaser.clean()
            execute.assert_called_with('clean command', replacements=ANY, dryrun=ANY, verbose=ANY)
开发者ID:eight04,项目名称:bumpr,代码行数:11,代码来源:test_releaser.py

示例10: test_test

def test_test(workspace, mocker):
    config = Config({
        'file': 'fake.py',
        'tests': 'test command',
    })
    releaser = Releaser(config)
    execute = mocker.patch('bumpr.releaser.execute')

    releaser.test()

    execute.assert_called_with('test command', replacements=mocker.ANY, dryrun=mocker.ANY, verbose=mocker.ANY)
开发者ID:noirbizarre,项目名称:bumpr,代码行数:11,代码来源:test_releaser.py

示例11: test_skip_test

def test_skip_test(workspace, mocker):
    config = Config({
        'file': 'fake.py',
        'tests': 'test command',
        'skip_tests': True,
    })
    releaser = Releaser(config)
    execute = mocker.patch('bumpr.releaser.execute')

    releaser.test()

    assert not execute.called
开发者ID:noirbizarre,项目名称:bumpr,代码行数:12,代码来源:test_releaser.py

示例12: test_release_wihtout_vcs_or_commands

    def test_release_wihtout_vcs_or_commands(self):
        with workspace('fake', '1.2.3.dev') as wksp:
            config = Config({'file': 'fake.py', 'files': [wksp.readme]})
            releaser = Releaser(config)
            with patch('bumpr.releaser.execute') as execute:
                with patch.object(releaser, 'commit') as commit:
                    releaser.release()
                    self.assertFalse(execute.called)
                    self.assertFalse(commit.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)
开发者ID:eight04,项目名称:bumpr,代码行数:15,代码来源:test_releaser.py

示例13: test_bump

    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)
开发者ID:eight04,项目名称:bumpr,代码行数:15,代码来源:test_releaser.py

示例14: test_release_wihtout_vcs_or_commands

def test_release_wihtout_vcs_or_commands(workspace, mocker):
    config = Config({'file': 'fake.py', 'files': [str(workspace.readme)]})
    releaser = Releaser(config)
    execute = mocker.patch('bumpr.releaser.execute')
    commit = mocker.patch.object(releaser, 'commit')

    releaser.release()

    assert not execute.called
    assert not commit.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
开发者ID:noirbizarre,项目名称:bumpr,代码行数:16,代码来源:test_releaser.py

示例15: main

def main():
    import sys
    from bumpr import log
    log.init()

    from bumpr.config import Config
    from bumpr.releaser import Releaser
    from bumpr.helpers import BumprError
    from logging import DEBUG, INFO, getLogger

    config = Config.parse_args()
    getLogger().setLevel(DEBUG if config.verbose else INFO)
    try:
        releaser = Releaser(config)
        releaser.release()
    except BumprError as error:
        getLogger(__name__).error(error.message)
        sys.exit(1)
开发者ID:justinmayer,项目名称:bumpr,代码行数:18,代码来源:__init__.py


注:本文中的bumpr.releaser.Releaser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。