def test_process_queue_item_retry(self):
        def raise_ioerror(*args):
            raise IOError("Fake IOError")

        with nested(
            mock.patch("%s.pushmanager.core.xmppclient.logging" % __name__),
            mock.patch("%s.pushmanager.core.xmppclient.xmpp.Message" % __name__),
            mock.patch("%s.pushmanager.core.xmppclient.XMPPQueue.message_queue" % __name__)
        ):
            jabber_client = mock.MagicMock()
            jabber_client.send.side_effect = raise_ioerror
            pushmanager.core.xmppclient.XMPPQueue.message_queue.configure_mock(**self.fake_queue_attrs)

            # Try sending the same message more than max_retry_count
            retry_count = pushmanager.core.xmppclient.XMPPQueue.MAX_RETRY_COUNT

            for _ in range(retry_count):
                pushmanager.core.xmppclient.XMPPQueue._process_queue_item(jabber_client)

            T.assert_equal(jabber_client.send.call_count, retry_count)
            T.assert_equal(pushmanager.core.xmppclient.XMPPQueue.message_queue.get.call_count, retry_count)
            T.assert_equal(pushmanager.core.xmppclient.XMPPQueue.message_queue.task_done.call_count, retry_count)
            T.assert_equal(pushmanager.core.xmppclient.XMPPQueue.message_queue.put.call_count, retry_count - 1)
dataset/ETHPy150Open YelpArchive/pushmanager/pushmanager/tests/test_core_xmppclient.py/CoreXMPPClientTest.test_process_queue_item_retry/original