'Test that creating threads in the threadpool with application-level
objects as arguments doesn\'t results in those objects never being
freed, with the thread maintaining a reference to them as long as it
exists.'

def test_threadCreationArguments(self):

    tp = threadpool.ThreadPool(0, 1)
    tp.start()
    self.addCleanup(tp.stop)
    self.assertEqual(tp.threads, [])
    def worker(arg):
        pass
    class Dumb(object, ):
        pass
    unique = Dumb()
    workerRef = weakref.ref(worker)
    uniqueRef = weakref.ref(unique)
    tp.callInThread(worker, unique)
    event = threading.Event()
    tp.callInThread(event.set)
    event.wait(self.getTimeout())
    del worker
    del unique
    gc.collect()
    self.assertIsNone(uniqueRef())
    self.assertIsNone(workerRef())
