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

Changeset 1727

Show
Ignore:
Timestamp:
09/27/07 15:11:24
Author:
fumanchu
Message:

Copied [1711] to trunk.

Files:

Legend:

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

    r1680 r1727  
    354354     
    355355    testList = [ 
     356        # Run refleak test ASAP to make debugging easier. 
     357        'test_refleaks', 
     358         
    356359        'test_proxy', 
    357360        'test_caching', 
  • trunk/cherrypy/test/test_http.py

    r1275 r1727  
    99test.prefer_parent_path() 
    1010 
    11 import gc 
    1211import httplib 
    13 import threading 
    1412import cherrypy 
    15 from cherrypy import _cprequest 
    1613 
    17  
    18 data = object() 
    19  
    20 def get_instances(cls): 
    21     return [x for x in gc.get_objects() if isinstance(x, cls)] 
    2214 
    2315def setup_server(): 
     
    2517    class Root: 
    2618        def index(self, *args, **kwargs): 
    27             cherrypy.request.thing = data 
    2819            return "Hello world!" 
    2920        index.exposed = True 
    30          
    31         def gc_stats(self): 
    32             return "%s %s %s %s" % (gc.collect(), 
    33                                     len(get_instances(_cprequest.Request)), 
    34                                     len(get_instances(_cprequest.Response)), 
    35                                     len(gc.get_referrers(data))) 
    36         gc_stats.exposed = True 
     21     
    3722    cherrypy.tree.mount(Root()) 
    3823    cherrypy.config.update({'environment': 'test_suite'}) 
     
    5237 
    5338 
    54 class ReferenceTests(helper.CPWebCase): 
    55      
    56     def test_threadlocal_garbage(self): 
    57         def getpage(): 
    58             self.getPage('/') 
    59             self.assertBody("Hello world!") 
    60          
    61         ts = [] 
    62         for _ in range(25): 
    63             t = threading.Thread(target=getpage) 
    64             ts.append(t) 
    65             t.start() 
    66          
    67         for t in ts: 
    68             t.join() 
    69          
    70         self.getPage("/gc_stats") 
    71         self.assertBody("0 1 1 1") 
    72  
    73  
    7439if __name__ == '__main__': 
    7540    setup_server() 

Hosted by WebFaction

Log in as guest/cpguest to create tickets