def test_close_noop_if_not_init(self): """ libhoney.close() should noop if never initialized """ try: libhoney.close() except AttributeError: self.fail('libhoney threw an exception on ' 'an uninitialized close.')
def post_report(self, report): local_rep = copy.deepcopy(report.report) format_report(local_rep) try: send_honeycomb(local_rep, self.config) except Exception as e: logger.debug("caught exception while sending report: {}".format(e)) finally: logger.debug("sent report to honeycomb") responses = libhoney.responses() resp = responses.get() if resp is None: logger.info("no response from honeycomb") else: logger.debug("got response from Honeycomb: {}".format(resp)) libhoney.close()
def setUp(self): # reset global state with each test libhoney.close()
def setUp(self): libhoney.close() self.tx = mock.Mock() self.m_xmit = mock.patch('libhoney.client.Transmission') self.m_xmit.start().return_value = self.tx
def test_close(self): mock_client = mock.Mock() libhoney.state.G_CLIENT = mock_client libhoney.close() mock_client.close.assert_called_with() self.assertEqual(libhoney.state.G_CLIENT, None)
def setUp(self): # reset global state with each test libhoney.close() self.mock_xmit = mock.Mock(return_value=mock.Mock())
def graceful_shutdown(signum, frame): libhoney.close()