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

Changeset 1936

Show
Ignore:
Timestamp:
04/03/08 03:04:27
Author:
fumanchu
Message:

Improved test_refleaks so it fails on errors in threads.

Files:

Legend:

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

    r1931 r1936  
    2626         
    2727        def gc_stats(self): 
    28             output = [
     28            output = ["Statistics:"
    2929             
    3030            # Uncollectable garbage 
     
    8686     
    8787    def test_threadlocal_garbage(self): 
     88        success = [] 
     89         
    8890        def getpage(): 
     91            host = '127.0.0.1:%s' % self.PORT 
    8992            if self.scheme == 'https': 
    90                 c = httplib.HTTPSConnection('127.0.0.1:%s' % self.PORT
     93                c = httplib.HTTPSConnection(host
    9194            else: 
    92                 c = httplib.HTTPConnection('127.0.0.1:%s' % self.PORT
     95                c = httplib.HTTPConnection(host
    9396            try: 
    94                 c.request('GET', '/') 
    95                 resp = c.getresponse() 
    96                 self.assertEqual(resp.status, 200) 
    97                 self.assertEqual(resp.read(), "Hello world!") 
     97                c.putrequest('GET', '/', skip_host=0) 
     98                c.putheader('Host', host) 
     99                c.endheaders() 
     100                response = c.getresponse() 
     101                body = response.read() 
     102                self.assertEqual(response.status, 200) 
     103                self.assertEqual(body, "Hello world!") 
    98104            finally: 
    99105                c.close() 
     106            success.append(True) 
    100107         
    101108        ts = [] 
     
    108115            t.join() 
    109116         
     117        self.assertEqual(len(success), 25) 
     118         
    110119        self.getPage("/gc_stats") 
    111         self.assertBody("") 
     120        self.assertBody("Statistics:") 
    112121 
    113122 

Hosted by WebFaction

Log in as guest/cpguest to create tickets