コード例 #1
0
ファイル: __init__.py プロジェクト: voronind/bumpr
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)
コード例 #2
0
ファイル: test_config.py プロジェクト: justinmayer/bumpr
    def test_override_args_keeps_config_values(self):
        bumprrc = '''\
        [bumpr]
        files = README
        [bump]
        message = test
        [prepare]
        part = minor
        '''

        with mock_ini(bumprrc) as mock:
            with patch('bumpr.config.exists', return_value=True):
                config = Config.parse_args(['test.py', '-M', '-v', '-s', 'test-suffix', '-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['file'] = 'test.py'
        expected['bump']['part'] = Version.MAJOR
        expected['bump']['suffix'] = 'test-suffix'
        expected['verbose'] = True

        expected['files'] = ['README']
        expected['bump']['message'] = 'test'
        expected['prepare']['part'] = Version.MINOR

        for hook in HOOKS:
            expected[hook.key] = False

        self.assertDictEqual(config, expected)
コード例 #3
0
    def test_override_args_keeps_config_values(self):
        bumprrc = '''\
        [bumpr]
        files = README
        [bump]
        message = test
        [prepare]
        part = minor
        '''

        with mock_ini(bumprrc) as mock:
            with patch('bumpr.config.exists', return_value=True):
                config = Config.parse_args([
                    'test.py', '-M', '-v', '-s', 'test-suffix', '-c', 'test.rc'
                ])

        expected = deepcopy(DEFAULTS)
        expected['file'] = 'test.py'
        expected['bump']['part'] = Version.MAJOR
        expected['bump']['suffix'] = 'test-suffix'
        expected['verbose'] = True

        expected['files'] = ['README']
        expected['bump']['message'] = 'test'
        expected['prepare']['part'] = Version.MINOR

        for hook in HOOKS:
            expected[hook.key] = False

        self.assertDictEqual(config, expected)
コード例 #4
0
ファイル: test_config.py プロジェクト: noirbizarre/bumpr
    def test_skip_tests_from_args(self):
        config = Config.parse_args(['-c', 'test.rc', '--skip-tests'])

        expected = deepcopy(DEFAULTS)
        expected['skip_tests'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #5
0
ファイル: test_config.py プロジェクト: noirbizarre/bumpr
    def test_do_override_commit(self):
        config = Config.parse_args(['-c', 'test.rc', '-nc'])

        expected = deepcopy(DEFAULTS)
        expected['commit'] = False

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #6
0
    def test_do_override_commit(self):
        config = Config.parse_args(["-c", "test.rc", "-nc"])

        expected = deepcopy(DEFAULTS)
        expected["commit"] = False

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #7
0
ファイル: test_config.py プロジェクト: noirbizarre/bumpr
    def test_force_push_from_args(self):
        config = Config.parse_args(['-c', 'test.rc', '--push'])

        expected = deepcopy(DEFAULTS)
        expected['push'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #8
0
ファイル: test_config.py プロジェクト: noirbizarre/bumpr
    def test_do_not_override_push_when_not_in_args(self, mocker, mock_ini):
        config = Config.parse_args(['-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['push'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #9
0
    def test_force_push_from_args(self):
        config = Config.parse_args(['-c', 'test.rc', '--push'])

        expected = deepcopy(DEFAULTS)
        expected['push'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #10
0
    def test_do_not_override_prepare_only_when_not_in_args(self):
        config = Config.parse_args(['-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['prepare_only'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #11
0
    def test_do_override_commit(self):
        config = Config.parse_args(['-c', 'test.rc', '-nc'])

        expected = deepcopy(DEFAULTS)
        expected['commit'] = False

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #12
0
    def test_skip_tests_from_args(self):
        config = Config.parse_args(['-c', 'test.rc', '--skip-tests'])

        expected = deepcopy(DEFAULTS)
        expected['skip_tests'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #13
0
    def test_do_not_override_bump_only_when_not_in_args(self):
        config = Config.parse_args(["-c", "test.rc"])

        expected = deepcopy(DEFAULTS)
        expected["bump_only"] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #14
0
ファイル: test_config.py プロジェクト: noirbizarre/bumpr
    def test_do_not_override_prepare_only_when_not_in_args(self):
        config = Config.parse_args(['-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['prepare_only'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #15
0
    def test_force_push_from_args(self):
        config = Config.parse_args(["-c", "test.rc", "--push"])

        expected = deepcopy(DEFAULTS)
        expected["push"] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #16
0
    def test_do_not_override_push_when_not_in_args(self, mocker, mock_ini):
        config = Config.parse_args(['-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['push'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #17
0
    def test_skip_tests_from_args(self):
        config = Config.parse_args(["-c", "test.rc", "--skip-tests"])

        expected = deepcopy(DEFAULTS)
        expected["skip_tests"] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #18
0
ファイル: test_config.py プロジェクト: justinmayer/bumpr
    def test_override_from_args(self):
        config = Config.parse_args(['test.py', '-M', '-v', '-s', 'test-suffix', '-c', 'fake'])

        expected = deepcopy(DEFAULTS)
        expected['file'] = 'test.py'
        expected['bump']['part'] = Version.MAJOR
        expected['bump']['suffix'] = 'test-suffix'
        expected['verbose'] = True
        for hook in HOOKS:
            expected[hook.key] = False

        self.assertDictEqual(config, expected)
コード例 #19
0
    def test_override_from_args(self):
        config = Config.parse_args(["test.py", "-M", "-v", "-s", "test-suffix", "-c", "fake"])

        expected = deepcopy(DEFAULTS)
        expected["file"] = "test.py"
        expected["bump"]["part"] = Version.MAJOR
        expected["bump"]["suffix"] = "test-suffix"
        expected["verbose"] = True
        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #20
0
    def test_override_from_args(self):
        config = Config.parse_args(
            ['test.py', '-M', '-v', '-s', 'test-suffix', '-c', 'fake'])

        expected = deepcopy(DEFAULTS)
        expected['file'] = 'test.py'
        expected['bump']['part'] = Version.MAJOR
        expected['bump']['suffix'] = 'test-suffix'
        expected['verbose'] = True
        for hook in HOOKS:
            expected[hook.key] = False

        self.assertDictEqual(config, expected)
コード例 #21
0
    def test_skip_tests_from_args(self):
        bumprrc = '''\
        [bumpr]
        '''

        with mock_ini(bumprrc):
            with patch('bumpr.config.exists', return_value=True):
                config = Config.parse_args(['-c', 'test.rc', '--skip-tests'])

        expected = deepcopy(DEFAULTS)
        expected['skip_tests'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #22
0
    def test_override_push_from_args(self):
        bumprrc = '''\
        [bumpr]
        push = true
        '''

        with mock_ini(bumprrc):
            with patch('bumpr.config.exists', return_value=True):
                config = Config.parse_args(['-c', 'test.rc', '--no-push'])

        expected = deepcopy(DEFAULTS)
        expected['push'] = False

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #23
0
    def test_do_override_commit(self):
        bumprrc = '''\
        [bumpr]
        commit = True
        '''

        with mock_ini(bumprrc):
            with patch('bumpr.config.exists', return_value=True):
                config = Config.parse_args(['-c', 'test.rc', '-nc'])

        expected = deepcopy(DEFAULTS)
        expected['commit'] = False

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #24
0
ファイル: test_config.py プロジェクト: noirbizarre/bumpr
    def test_override_args_keeps_config_values(self):
        config = Config.parse_args(['test.py', '-M', '-v', '-s', 'test-suffix', '-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['file'] = 'test.py'
        expected['bump']['part'] = Version.MAJOR
        expected['bump']['suffix'] = 'test-suffix'
        expected['verbose'] = True

        expected['files'] = ['README']
        expected['bump']['message'] = 'test'
        expected['prepare']['part'] = Version.MINOR

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #25
0
    def test_do_not_override_prepare_only_when_not_in_args(self):
        bumprrc = '''\
        [bumpr]
        prepare_only = True
        '''

        with mock_ini(bumprrc):
            with patch('bumpr.config.exists', return_value=True):
                config = Config.parse_args(['-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['prepare_only'] = True

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #26
0
    def test_override_args_keeps_config_values(self):
        config = Config.parse_args(["test.py", "-M", "-v", "-s", "test-suffix", "-c", "test.rc"])

        expected = deepcopy(DEFAULTS)
        expected["file"] = "test.py"
        expected["bump"]["part"] = Version.MAJOR
        expected["bump"]["suffix"] = "test-suffix"
        expected["verbose"] = True

        expected["files"] = ["README"]
        expected["bump"]["message"] = "test"
        expected["prepare"]["part"] = Version.MINOR

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected
コード例 #27
0
ファイル: __init__.py プロジェクト: connectthefuture/bumpr
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)
コード例 #28
0
    def test_override_args_keeps_config_values(self):
        config = Config.parse_args(
            ['test.py', '-M', '-v', '-s', 'test-suffix', '-c', 'test.rc'])

        expected = deepcopy(DEFAULTS)
        expected['file'] = 'test.py'
        expected['bump']['part'] = Version.MAJOR
        expected['bump']['suffix'] = 'test-suffix'
        expected['verbose'] = True

        expected['files'] = ['README']
        expected['bump']['message'] = 'test'
        expected['prepare']['part'] = Version.MINOR

        for hook in HOOKS:
            expected[hook.key] = False

        assert config == expected