diff options
author | Robert Brewer <fumanchu@aminus.org> | 2008-04-03 08:04:27 +0000 |
---|---|---|
committer | Robert Brewer <fumanchu@aminus.org> | 2008-04-03 08:04:27 +0000 |
commit | c87d56877e174fc8111208a3e96e14ff077a798f (patch) | |
tree | d3af124a90d81e7d3f7606c2cff0e8f11870d44d | |
parent | acd01a2c1070d0f35d86ae515a0c96d439774753 (diff) | |
download | cherrypy-c87d56877e174fc8111208a3e96e14ff077a798f.tar.gz |
Improved test_refleaks so it fails on errors in threads.
-rw-r--r-- | cherrypy/test/test_refleaks.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/cherrypy/test/test_refleaks.py b/cherrypy/test/test_refleaks.py index 07a0fc5b..5359ef22 100644 --- a/cherrypy/test/test_refleaks.py +++ b/cherrypy/test/test_refleaks.py @@ -25,7 +25,7 @@ def setup_server(): index.exposed = True def gc_stats(self): - output = [] + output = ["Statistics:"] # Uncollectable garbage @@ -85,18 +85,25 @@ from cherrypy.test import helper class ReferenceTests(helper.CPWebCase): def test_threadlocal_garbage(self): + success = [] + def getpage(): + host = '127.0.0.1:%s' % self.PORT if self.scheme == 'https': - c = httplib.HTTPSConnection('127.0.0.1:%s' % self.PORT) + c = httplib.HTTPSConnection(host) else: - c = httplib.HTTPConnection('127.0.0.1:%s' % self.PORT) + c = httplib.HTTPConnection(host) try: - c.request('GET', '/') - resp = c.getresponse() - self.assertEqual(resp.status, 200) - self.assertEqual(resp.read(), "Hello world!") + c.putrequest('GET', '/', skip_host=0) + c.putheader('Host', host) + c.endheaders() + response = c.getresponse() + body = response.read() + self.assertEqual(response.status, 200) + self.assertEqual(body, "Hello world!") finally: c.close() + success.append(True) ts = [] for _ in range(25): @@ -107,8 +114,10 @@ class ReferenceTests(helper.CPWebCase): for t in ts: t.join() + self.assertEqual(len(success), 25) + self.getPage("/gc_stats") - self.assertBody("") + self.assertBody("Statistics:") if __name__ == '__main__': |