예제 #1
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.prev_version = Version.parse("1.2.3.dev")
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.next_version = Version.parse("1.2.4.dev")
     self.releaser.timestamp = datetime.now()
     self.releaser.tag_label = "v1.2.3"
     self.releaser.config = Config()
예제 #2
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.prev_version = Version.parse('1.2.3.dev')
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.next_version = Version.parse('1.2.4.dev')
     self.releaser.timestamp = datetime.now()
     self.releaser.tag_label = 'v1.2.3'
     self.releaser.config = Config()
예제 #3
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.prev_version = Version.parse('1.2.3.dev')
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.next_version = Version.parse('1.2.4.dev')
     self.releaser.timestamp = datetime.now()
     self.releaser.config.__getitem__.return_value = ObjectDict({})
     self.releaser.config.encoding = 'utf8'
     self.releaser.config.verbose = False
     self.releaser.config.dryrun = False
예제 #4
0
 def setUp(self):
     self.releaser = MagicMock()
     self.releaser.prev_version = Version.parse('1.2.3.dev')
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.next_version = Version.parse('1.2.4.dev')
     self.releaser.timestamp = datetime.now()
     self.releaser.config.__getitem__.return_value = ObjectDict({})
     self.releaser.config.encoding = 'utf8'
     self.releaser.config.verbose = False
     self.releaser.config.dryrun = False
예제 #5
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.prev_version = Version.parse("1.2.3.dev")
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.next_version = Version.parse("1.2.4.dev")
     self.releaser.timestamp = datetime.now()
     self.releaser.config.__getitem__.return_value = ObjectDict({})
     self.releaser.config.encoding = "utf8"
     self.releaser.config.verbose = False
     self.releaser.config.dryrun = False
예제 #6
0
    def __init__(self, config):
        self.config = config

        with open(config.file) as f:
            match = re.search(config.regex, f.read())
            try:
                version_string = match.group('version')
                self.prev_version = Version.parse(version_string)
            except:
                raise BumprError('Version not found in {}'.format(config.file))

        logger.debug('Previous version: {0}'.format(self.prev_version))

        self.version = self.prev_version.copy()
        self.version.bump(config.bump.part, config.bump.unsuffix, config.bump.suffix)
        logger.debug('Bumped version: {0}'.format(self.version))

        self.next_version = self.version.copy()
        self.next_version.bump(config.prepare.part, config.prepare.unsuffix, config.prepare.suffix)
        logger.debug('Prepared version: {0}'.format(self.next_version))

        self.timestamp = None

        if config.vcs:
            self.vcs = VCS[config.vcs](verbose=config.verbose)
            self.vcs.validate()

        if config.dryrun:
            self.diffs = {}

        self.hooks = [hook(self) for hook in HOOKS if self.config[hook.key]]
예제 #7
0
def test_parse_with_suffix():
    version = Version.parse('1.2.3.rc4')

    assert version is not None
    assert version.major == 1
    assert version.minor == 2
    assert version.patch == 3
    assert version.suffix == 'rc4'
예제 #8
0
    def test_parse(self):
        version = Version.parse('1.2.3')

        self.assertIsNotNone(version)
        self.assertEqual(version.major, 1)
        self.assertEqual(version.minor, 2)
        self.assertEqual(version.patch, 3)
        self.assertEqual(version.suffix, None)
예제 #9
0
def test_parse():
    version = Version.parse('1.2.3')

    assert version is not None
    assert version.major == 1
    assert version.minor == 2
    assert version.patch == 3
    assert version.suffix is None
예제 #10
0
    def test_parse_with_suffix(self):
        version = Version.parse('1.2.3.rc4')

        self.assertIsNotNone(version)
        self.assertEqual(version.major, 1)
        self.assertEqual(version.minor, 2)
        self.assertEqual(version.patch, 3)
        self.assertEqual(version.suffix, 'rc4')
예제 #11
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.config.__getitem__.return_value = ObjectDict({
         'bump': 'bump command',
         'prepare': 'prepare command',
     })
     self.releaser.config.verbose = False
     self.releaser.config.dryrun = False
     self.hook = CommandsHook(self.releaser)
예제 #12
0
파일: test_hooks.py 프로젝트: eight04/bumpr
 def setUp(self):
     self.releaser = MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.config.__getitem__.return_value = ObjectDict({
         'id': 'fake',
         'url': 'http://{id}.somewhere.io/{tag}',
         'bump': '{version}',
         'prepare': 'latest',
     })
     self.hook = ReadTheDocHook(self.releaser)
예제 #13
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.config.__getitem__.return_value = ObjectDict({
         "bump":
         "bump command",
         "prepare":
         "prepare command",
     })
     self.releaser.config.verbose = False
     self.releaser.config.dryrun = False
     self.hook = CommandsHook(self.releaser)
예제 #14
0
 def setUp(self):
     self.releaser = MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.config.__getitem__.return_value = ObjectDict({
         'bump':
         'bump command',
         'prepare':
         'prepare command',
     })
     self.releaser.config.verbose = False
     self.releaser.config.dryrun = False
     self.hook = CommandsHook(self.releaser)
예제 #15
0
 def setUp(self):
     self.releaser = MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.config.__getitem__.return_value = ObjectDict({
         'id':
         'fake',
         'url':
         'http://{id}.somewhere.io/{tag}',
         'bump':
         '{version}',
         'prepare':
         'latest',
     })
     self.hook = ReadTheDocHook(self.releaser)
예제 #16
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.tag_label = "1.2.3"
     self.releaser.config.__getitem__.return_value = ObjectDict({
         "id":
         "fake",
         "url":
         "http://{id}.somewhere.io/{tag}",
         "badge":
         "http://{id}.somewhere.io/badge/{tag}",
         "bump":
         "{version}",
         "prepare":
         "latest",
     })
     self.hook = ReadTheDocHook(self.releaser)
예제 #17
0
파일: releaser.py 프로젝트: voronind/bumpr
    def __init__(self, config):
        self.config = config

        with open(config.file) as f:
            match = re.search(config.regex, f.read())
            try:
                version_string = match.group('version')
                self.prev_version = Version.parse(version_string)
            except Exception:
                raise BumprError('Unable to extract version from {0}'.format(
                    config.file))

        logger.debug('Previous version: {0}'.format(self.prev_version))

        self.version = self.prev_version.copy()
        self.version.bump(config.bump.part, config.bump.unsuffix,
                          config.bump.suffix)
        logger.debug('Bumped version: {0}'.format(self.version))

        self.next_version = self.version.copy()
        self.next_version.bump(config.prepare.part, config.prepare.unsuffix,
                               config.prepare.suffix)
        logger.debug('Prepared version: {0}'.format(self.next_version))

        self.tag_label = self.config.tag_format.format(version=self.version)
        logger.debug('Tag: {0}'.format(self.tag_label))
        if self.config.tag_annotation:
            self.tag_annotation = self.config.tag_annotation.format(
                version=self.version)
            logger.debug('Tag annotation: {0}'.format(self.tag_annotation))

        self.timestamp = None

        if config.vcs:
            self.vcs = VCS[config.vcs](verbose=config.verbose)
            self.vcs.validate(dryrun=config.dryrun)

        if config.dryrun:
            self.modified = {}
            self.diffs = {}

        self.hooks = [hook(self) for hook in HOOKS if self.config[hook.key]]
예제 #18
0
    def __init__(self, config):
        self.config = config

        with open(config.file) as f:
            match = re.search(config.regex, f.read())
            try:
                version_string = match.group('version')
                self.prev_version = Version.parse(version_string)
            except Exception:
                raise BumprError('Unable to extract version from {0}'.format(config.file))

        logger.debug('Previous version: {0}'.format(self.prev_version))

        self.version = self.prev_version.copy()
        self.version.bump(config.bump.part, config.bump.unsuffix, config.bump.suffix)
        logger.debug('Bumped version: {0}'.format(self.version))

        self.next_version = self.version.copy()
        self.next_version.bump(config.prepare.part, config.prepare.unsuffix, config.prepare.suffix)
        logger.debug('Prepared version: {0}'.format(self.next_version))

        self.tag_label = self.config.tag_format.format(version=self.version)
        logger.debug('Tag: {0}'.format(self.tag_label))
        if self.config.tag_annotation:
            self.tag_annotation = self.config.tag_annotation.format(version=self.version)
            logger.debug('Tag annotation: {0}'.format(self.tag_annotation))

        self.timestamp = None

        if config.vcs:
            self.vcs = VCS[config.vcs](verbose=config.verbose)
            self.vcs.validate(dryrun=config.dryrun)

        if config.dryrun:
            self.modified = {}
            self.diffs = {}

        self.hooks = [hook(self) for hook in HOOKS if self.config[hook.key]]
예제 #19
0
 def setUp(self, workspace, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.tag_label = 'v1.2.3'
     self.releaser.config = Config({ReadTheDocHook.key: {'id': 'fake'}})
     self.hook = ReadTheDocHook(self.releaser)
예제 #20
0
 def setUp(self, workspace, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.tag_label = 'v1.2.3'
     self.releaser.config = Config({ReadTheDocHook.key: {'id': 'fake'}})
     self.hook = ReadTheDocHook(self.releaser)
예제 #21
0
 def setUp(self, workspace, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.tag_label = "v1.2.3"
     self.releaser.config = Config({ReadTheDocHook.key: {"id": "fake"}})
     self.hook = ReadTheDocHook(self.releaser)