Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 542

Show
Ignore:
Timestamp:
08/18/05 13:51:38
Author:
fumanchu
Message:

Added filename, "percent covered" to covercp reports.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/covercp.py

    r522 r542  
    5757    def start(): 
    5858        coverage.start() 
    59      
    6059except ImportError: 
    6160    # Setting coverage to None will raise errors 
     
    9190        if runs: 
    9291            base = "" 
    93             for x in runs: 
    94                 newbase, fname = x 
     92            for newbase, fname in runs: 
     93                # Make each directory a new section with a header 
    9594                if base != newbase: 
    9695                    base = newbase 
    9796                    yield "<h3>%s</h3>\n" % newbase 
     97                 
     98                # Yield a link to each annotated file. 
    9899                yield ("<a href='report?name=%s' target='main'>%s</a><br />\n" 
    99100                       % (os.path.join(newbase, fname), fname)) 
     
    146147        import cherrypy 
    147148        cherrypy.response.headerMap['Content-Type'] = 'text/plain' 
     149         
     150        yield name 
     151        yield "\n" 
     152         
    148153        coverage.get_ready() 
    149154        filename, statements, excluded, missing, _ = coverage.analysis2(name) 
    150         return self.annotated_file(filename, statements, excluded, missing) 
     155        s = len(statements) 
     156        e = s - len(missing) 
     157        if s > 0: 
     158            pc = 100.0 * e / s 
     159            yield "%2d%% covered\n" % pc 
     160         
     161        yield "\n" 
     162        yield self.annotated_file(filename, statements, excluded, missing) 
    151163    report.exposed = True 
    152164 
     
    162174                            'server.threadPool': 10, 
    163175                            'server.environment': "production", 
    164                             'session.storageType': "ram", 
    165176                            }) 
    166177    cherrypy.server.start() 

Hosted by WebFaction

Log in as guest/cpguest to create tickets