def lookup_source_info(self, repository): """Return the SourceInfo for the given repository.""" filename = repository.name + '-meta.yml' dir_path = os.path.join(self.__options.output_dir, 'source_info') build_number = self.determine_build_number(repository) with open(os.path.join(dir_path, filename), 'r') as stream: return SourceInfo(build_number, RepositorySummary.from_dict(yaml.load(stream.read())))
def lookup_source_info(self, repository): """Return the SourceInfo for the given repository.""" filename = repository.name + '-meta.yml' dir_path = os.path.join(self.__options.output_dir, 'source_info') build_number = self.determine_build_number(repository) with open(os.path.join(dir_path, filename), 'r') as stream: return SourceInfo( build_number, RepositorySummary.from_dict(yaml.safe_load(stream.read())))
def test_yamilfy(self): # The summary values are arbitrary. Just verifying we can go in and out # of yaml. summary = RepositorySummary('abcd', 'tag-123', '1.2.0', '1.1.5', [ CommitMessage('commitB', 'authorB', 'dateB', 'messageB'), CommitMessage('commitA', 'authorA', 'dateA', 'messageA') ]) yamlized = yaml.safe_load(summary.to_yaml()) self.assertEqual(summary.commit_id, yamlized['commit_id']) self.assertEqual(summary.tag, yamlized['tag']) self.assertEqual(summary.version, yamlized['version']) self.assertEqual(summary.prev_version, yamlized['prev_version']) self.assertEqual([{ 'commit_id': 'commit' + x, 'author': 'author' + x, 'date': 'date' + x, 'message': 'message' + x } for x in ['B', 'A']], yamlized['commit_messages']) self.assertEqual(summary, RepositorySummary.from_dict(yamlized))
def test_yamilfy(self): # The summary values are arbitrary. Just verifying we can go in and out # of yaml. summary = RepositorySummary( 'abcd', 'tag-123', '1.2.0', '1.1.5', [ CommitMessage('commitB', 'authorB', 'dateB', 'messageB'), CommitMessage('commitA', 'authorA', 'dateA', 'messageA') ]) yamlized = yaml.safe_load(summary.to_yaml()) self.assertEqual(summary.commit_id, yamlized['commit_id']) self.assertEqual(summary.tag, yamlized['tag']) self.assertEqual(summary.version, yamlized['version']) self.assertEqual(summary.prev_version, yamlized['prev_version']) self.assertEqual( [{ 'commit_id': 'commit' + x, 'author': 'author' + x, 'date': 'date' + x, 'message': 'message' + x} for x in ['B', 'A']], yamlized['commit_messages']) self.assertEqual(summary, RepositorySummary.from_dict(yamlized))