def test_context_manager_exception(self): with self.assertRaises(RuntimeError): with parallel_task_queue() as queue: queue.enqueue_task(_fake_task, 1, a=2) queue.enqueue_task(_fake_exception)
def test_context_manager(self): with parallel_task_queue() as queue: queue.enqueue_task(_fake_task, 1, a=2) queue.enqueue_task(_fake_task, 3, b=4) global_mock.assert_has_calls([call(1, a=2), call(3, b=4)], any_order=True)