Skip to content

Instantly share code, notes, and snippets.

@djmitche
Created February 21, 2010 01:12
Show Gist options
  • Select an option

  • Save djmitche/310039 to your computer and use it in GitHub Desktop.

Select an option

Save djmitche/310039 to your computer and use it in GitHub Desktop.
import threading
from twisted.python import threadpool
from twisted.internet import threads
from twisted.trial import unittest
class t(unittest.TestCase):
def setUp(self):
self.pool = threadpool.ThreadPool(3, 5)
self.pool.start()
def tearDown(self):
print list(threading.enumerate())
def testit(self):
from twisted.internet import reactor
return threads.deferToThreadPool(reactor, self.pool, lambda : True)
def testit2(self):
return self.testit()
def testit3(self):
return self.testit()
def testit4(self):
return self.testit()
def testit5(self):
return self.testit()
def testit6(self):
return self.testit()
def testit7(self):
return self.testit()
def testit8(self):
return self.testit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment