def __init__(self, config=None, keep_version=False, offline=False, user_config=None): VersionTagger.__init__(self, config=config) self.gemspec_file_name = find_file_with_extension(suffix=".gemspec") new_version = subprocess.check_output( ["ruby", "-e", "gspec = eval(File.read('" + self.gemspec_file_name + "')); " + "print(gspec.version)"] ) regex = re.compile("^(\d+(?:\.\d+)*)-?(.*)$") match = re.match(regex, new_version) if match: debug("Deduced version='%s' release='%s'" % (match.group(1), match.group(2))) self._use_version = match.group(1) """ The release value is currently parsed, but unused. """ self._use_release = match.group(2)
def __init__(self, config=None, keep_version=False, offline=False, user_config=None): VersionTagger.__init__(self, config=config) self.gemspec_file_name = find_file_with_extension(suffix=".gemspec") new_version = subprocess.check_output([ "ruby", "-e", "gspec = eval(File.read('" + self.gemspec_file_name + "')); " + "print(gspec.version)" ]) regex = re.compile("^(\d+(?:\.\d+)*)-?(.*)$") match = re.match(regex, new_version) if match: debug("Deduced version='%s' release='%s'" % (match.group(1), match.group(2))) self._use_version = match.group(1) """ The release value is currently parsed, but unused. """ self._use_release = match.group(2)
def test_find_file_with_extension_no_match(self, mock_listdir): mock_listdir.return_value = ["hello.txt"] result = find_file_with_extension("/tmp", ".foo") self.assertEquals(mock_listdir.mock_calls[0], call("/tmp")) self.assertEqual(None, result)