def __init__(self, status, listings): super(Summary, self).__init__(title=Title('Failures summary'), status=status, properties=None, lines=None, listings=listings) self.div_style = Style.get().summary['div_style']
def __init__(self, title, status, properties, lines, summary): super(ReportableListing, self).__init__(title, status, properties, lines, listings=None, summary=summary) self.div_style = Style.get().reportable['div_style']
def __init__(self, title, status, properties=None, lines=None, listings=None, summary=None): super(Listing, self).__init__() self.title = title self.status = status self.properties = properties self.lines = lines self.listings = listings self.div_style = Style.get().listing['div_style'] self.status_style = Style.get().status[self.status.status.lower()] self.summary = summary if self.summary is None: self.summary = self.title.title
def __init__(self, title, status, listings, enable_summary=False): super(StepListing, self).__init__(title=title, status=status, properties=None, lines=None, listings=listings, summary=None) self.enable_summary = enable_summary self.div_style = Style.get().step['div_style']
def write_listing(self): template = Template(file_to_str(Listing.TEMPLATE)) properties = '' if self.properties is not None: properties += self.properties.write() lines = '' if self.lines is not None: lines += self.lines.write() return template.substitute(TITLE=self.title.write(),\ STATUS=self.status.write(),\ PROPERTIES=properties,\ LINES=lines,\ LISTINGS='',\ DIV_STYLE=Listing.join_styles([Style.get().listing['div_style'], self.div_style, self.status_style]))
def write_listing(self): template = Template(file_to_str(Listing.TEMPLATE)) listings = '' if self.listings is not None: if self.status.status == pyven.constants.STATUS[1]: listings += Summary(self.status, self.listings).write() for listing in self.listings: listings += HTMLUtils.line_separator() listings += listing.write() return template.substitute(TITLE=self.title.write(),\ STATUS=self.status.write(),\ PROPERTIES='',\ LINES='',\ LISTINGS=listings,\ DIV_STYLE=Listing.join_styles([Style.get().listing['div_style'], self.div_style, self.status_style]))
def write_listing(self): template = Template(file_to_str(Listing.TEMPLATE)) failures = [] if self.listings is not None: for listing in self.listings: if listing.status.status == pyven.constants.STATUS[1]: failures.append( Line([HTMLUtils.link(listing.summary, listing.href())])) lines = Lines(failures) return template.substitute(TITLE=self.title.write(),\ STATUS='',\ PROPERTIES='',\ LINES=lines.write(),\ LISTINGS='',\ DIV_STYLE=Listing.join_styles([Style.get().listing['div_style'], self.div_style, self.status_style]))
def aggregate(workspace): report_dir = os.path.join(workspace, 'report') if not os.path.isdir(report_dir): os.makedirs(report_dir) template_file = os.path.join(HTMLUtils.TEMPLATE_DIR, HTMLUtils.TEMPLATE_FILE) if not os.path.isfile(template_file): HTMLUtils.generate_template() template = Template(file_to_str(template_file)) title = 'Build report' if 'BUILD_NUMBER' in os.environ: title = 'Jenkins - Build #' + os.environ.get('BUILD_NUMBER') str = template.substitute(STYLE=Style.get().write(), TITLE=title, CONTENT=HTMLUtils.write_body(workspace), PVN_VERSION=pyven.constants.VERSION) str_to_file(str, os.path.join(report_dir, HTMLUtils.INDEX))
def set_style(style): Style.get().name = style
def __init__(self, title): super(Title, self).__init__() self.title = title self.title_style = Style.get().title['title_style']
def __init__(self): super(Success, self).__init__(pyven.constants.STATUS[0]) self.status_style = Style.get().status['success']
def line_separator(): return HTMLUtils.ltag('div', {'class': Style.get().line_separator }) + HTMLUtils.rtag('div')
def __init__(self, line): super(Line, self).__init__() self.line = line self.div_style = Style.get().line['div_style'] self.part_style = Style.get().line['part_style'] self.type_style = ''
def __init__(self): super(Failure, self).__init__(pyven.constants.STATUS[1]) self.status_style = Style.get().status['failure']
def __init__(self): super(Unknown, self).__init__(pyven.constants.STATUS[2]) self.status_style = Style.get().status['unknown']
def __init__(self, line): super(Warning, self).__init__(line) self.type_style = Style.get().line['warning']
def __init__(self, title, status, listings): super(Platform, self).__init__(title=title, status=status, properties=None, lines=None, listings=listings, summary=None) self.div_style = Style.get().platform['div_style']
def __init__(self, line): super(Error, self).__init__(line) self.type_style = Style.get().line['error']
def __init__(self, status): super(Status, self).__init__() self.status = status self.div_style = Style.get().status['div_style'] self.span_style = Style.get().status['span_style'] self.status_style = ''
def __init__(self, lines=[]): super(Lines, self).__init__() self.lines = lines self.div_style = Style.get().lines['div_style']
def __init__(self, properties=[]): super(Properties, self).__init__() self.properties = properties self.div_style = Style.get().properties['div_style']