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()
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()
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
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
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
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]]
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'
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)
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
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')
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)
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)
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)
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)
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)
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]]
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]]
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)
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)