Exemplo n.º 1
0
    def __call__(self, data, path ):

        lines = []
        dirname = os.path.join( os.path.dirname(sys.modules["SphinxReport"].__file__), "images" )
        descriptions = {}
        title = "status"

        # add header
        lines.append( ".. csv-table:: %s" % "table" )
        lines.append( '   :header: "Track", "Test", "", "Status", "Info" ' )
        lines.append( '' )

        for testname, w in data.iteritems():
            for track, work in w.iteritems():
            
                status = str(work['status']).strip()
                descriptions[testname] = work['description']
                info = str(work['info']).strip()
                try:
                    image = ".. image:: %s" % os.path.join( dirname, self.map_code2image[status.upper()] )
                except KeyError:
                    image = ""

                lines.append( '   "%(track)s",":term:`%(testname)s`","%(image)s","%(status)s","%(info)s"' % locals() )
                
        lines.append( "") 
        
        lines.append( ".. glossary::" )
        lines.append( "" )

        for test, description in descriptions.iteritems():
            lines.append( '%s\n%s\n' % (Utils.indent(test,3), Utils.indent( description,6) ) )
        
        return ResultBlocks( ResultBlock( "\n".join(lines), title = "") )        
Exemplo n.º 2
0
    def __call__(self, dataframe, path ):

        # convert to dataframe
        # index has test names
        # columns are description, info, status
        columns = ('description', 'info', 'status', 'name')
        if set(dataframe.columns) != set(columns):
            raise ValueError( "invalid columns: expected '%s', got '%s' " %\
                                  (columns, dataframe.columns))
        
        lines = []
        dirname = os.path.join( os.path.dirname(sys.modules["SphinxReport"].__file__), "images" )
        descriptions = {}
        title = "status"

        # add header
        lines.append( ".. csv-table:: %s" % "table" )
        lines.append( "   :class: sortable" )
        lines.append( '   :header: "Track", "Test", "", "Status", "Info" ' )
        lines.append( '' )

        for index, values in dataframe.iterrows():

            testname=values['name']
            description=values['description']
            info = values['info']
            status = values['status']
            track = index

            descriptions[testname] = description

            try:
                image = ".. image:: %s" % os.path.join( dirname, self.map_code2image[status.upper()] )
            except KeyError:
                image = ""

            lines.append( '   "%(track)s",":term:`%(testname)s`","%(image)s","%(status)s","%(info)s"' % locals() )
                
        lines.append( "") 
        
        lines.append( ".. glossary::" )
        lines.append( "" )

        for test, description in descriptions.items():
            lines.append( '%s\n%s\n' % (Utils.indent(test,3), Utils.indent( description,6) ) )
        
        return ResultBlocks( ResultBlock( "\n".join(lines), title = "") )