class WorkQueueTestCase(unittest.TestCase): def setUp(self): self.wq = WorkQueue() def tearDown(self): self.wq.stop() def _capture_thread(self): self.invoking_thread = threading.currentThread() self.sem.release() def test_fire(self): self.sem = threading.Semaphore(0) self.wq.push(self._capture_thread) self.sem.acquire() assert self.invoking_thread != threading.currentThread()
def setUp(self): self.wq = WorkQueue()