def processJinjaTemplate(input_file, output_file, context): (template_path, template_name) = os.path.split(input_file) env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_path), trim_blocks=True) template = env.get_template(template_name) rendered = template.render(context) rendered_without_comments = Nom(rendered) # Simply for validation. json.loads(rendered_without_comments) with io.open(output_file, 'w', encoding='utf-8') as manifest_file: manifest_file.write(rendered_without_comments)
def testEverything(self): json, expected_json = self._Load('everything') self.assertEqual(expected_json, Nom(json))