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

Changeset 1709

Show
Ignore:
Timestamp:
08/23/07 14:01:04
Author:
fumanchu
Message:

Added code to print unreachable object typecounts. See #718.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-3.0.x/cherrypy/test/test_http.py

    r1275 r1709  
    3535                                    len(gc.get_referrers(data))) 
    3636        gc_stats.exposed = True 
     37         
     38        def gc_objtypes(self): 
     39            data = {} 
     40            for x in gc.get_objects(): 
     41                data[type(x)] = data.get(type(x), 0) + 1 
     42             
     43            data = [(v, k) for k, v in data.iteritems()] 
     44            data.sort() 
     45            return "\n".join([repr(pair) for pair in data]) 
     46        gc_objtypes.exposed = True 
     47     
    3748    cherrypy.tree.mount(Root()) 
    3849    cherrypy.config.update({'environment': 'test_suite'}) 
     
    7081        self.getPage("/gc_stats") 
    7182        self.assertBody("0 1 1 1") 
     83         
     84        # If gc_stats fails, choose "ignore" to see the type counts for 
     85        # all the unreachable objects in this body. 
     86        self.getPage("/gc_objtypes") 
     87        self.assertBody("") 
    7288 
    7389 

Hosted by WebFaction

Log in as guest/cpguest to create tickets