def test__tryConnection_will_not_retry_if_autoReconnect_not_set(self):
listener = PostgresListenerService()
listener.autoReconnect = False
exception_type = factory.make_exception_type()
exception_message = factory.make_name("message")
startConnection = self.patch(listener, "startConnection")
startConnection.side_effect = exception_type(exception_message)
deferLater = self.patch(listener_module, "deferLater")
deferLater.return_value = sentinel.retry
with ExpectedException(exception_type):
yield listener.tryConnection()
self.assertThat(deferLater, MockNotCalled())
评论列表
文章目录