def render_report(self, report, filename, log_dir, template): template_env = Environment(loader=FileSystemLoader(template_path.strpath)) data = template_env.get_template(template).render(**report) with open(os.path.join(log_dir, "{}.html".format(filename)), "w") as f: f.write(data) try: shutil.copytree(template_path.join("dist").strpath, os.path.join(log_dir, "dist")) except OSError: pass
this_suite.groups.append(the_group) # break here as the suite is found and has the right group now break # If the suite is not found, then we create it, and the group else: the_suite = copy.deepcopy(suite) prov_suites[prov].append(the_suite) the_suite.groups = [] params = sorted( [param for param in group.params if prov in param]) the_group = Group(params) the_suite.groups.append(the_group) # once we are sure we have the right suite and group, we simple append the # test to the suites groups # darn jinja needing data in the right format the_tests = copy.deepcopy(group.tests) the_group.tests = the_tests # write the page for the specific prov data = template_env.get_template('test_matrix.html').render( {'suites': prov_suites[prov]}) with open(os.path.join(log_path.strpath, '{}.html'.format(prov)), "w") as f: f.write(data) try: shutil.copytree( template_path.join('dist').strpath, os.path.join(log_path.strpath, 'dist')) except OSError: pass
# if we finish the loop and no group is found, add it else: params = sorted([param for param in group.params if prov in param]) the_group = Group(params) this_suite.groups.append(the_group) # break here as the suite is found and has the right group now break # If the suite is not found, then we create it, and the group else: the_suite = copy.deepcopy(suite) prov_suites[prov].append(the_suite) the_suite.groups = [] params = sorted([param for param in group.params if prov in param]) the_group = Group(params) the_suite.groups.append(the_group) # once we are sure we have the right suite and group, we simple append the # test to the suites groups # darn jinja needing data in the right format the_tests = copy.deepcopy(group.tests) the_group.tests = the_tests # write the page for the specific prov data = template_env.get_template('test_matrix.html').render({'suites': prov_suites[prov]}) with open(os.path.join(log_path.strpath, '{}.html'.format(prov)), "w") as f: f.write(data) try: shutil.copytree(template_path.join('dist').strpath, os.path.join(log_path.strpath, 'dist')) except OSError: pass