def test_yaml_snippet(self): expected_xml = self._read_utf8_content() yaml_filepath = os.path.join(self.fixtures_path, self.in_filename) if self.conf_filename: config = configparser.ConfigParser() conf_filepath = os.path.join(self.fixtures_path, self.conf_filename) config.readfp(open(conf_filepath)) else: config = None parser = YamlParser(config) parser.parse(yaml_filepath) # Generate the XML tree parser.expandYaml() parser.generateXML() parser.xml_jobs.sort(key=operator.attrgetter('name')) # Prettify generated XML pretty_xml = u"\n".join(job.output().decode('utf-8') for job in parser.xml_jobs) self.assertThat( pretty_xml, testtools.matchers.DocTestMatches( expected_xml, doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF))
def test_yaml_snippet(self): expected_xml = self._read_utf8_content() if self.conf_filename: config = configparser.ConfigParser() config.readfp(open(self.conf_filename)) else: config = None parser = YamlParser(config) parser.parse(self.in_filename) # Generate the XML tree parser.expandYaml() parser.generateXML() parser.xml_jobs.sort(key=operator.attrgetter('name')) # Prettify generated XML pretty_xml = u"\n".join(job.output().decode('utf-8') for job in parser.xml_jobs) self.assertThat( pretty_xml, testtools.matchers.DocTestMatches(expected_xml, doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF) )