Esempio n. 1
0
    def test_uninstrumented_clients_no_longer_traces(self):
        tracer = MockTracer()
        opentracing.tracer = tracer
        config.tracer = tracer

        instrument(tracer)
        session = requests.Session()
        with mock.patch.object(requests.Session, 'request', mocked_request):
            session.get('some_url')

        spans = tracer.finished_spans()
        assert len(spans) == 1
        assert spans[0].operation_name == 'requests.get'

        uninstrument()
        tracer.reset()

        session = requests.Session()
        with mock.patch.object(requests.Session, 'request', mocked_request):
            session.get('some_url')

        assert not tracer.finished_spans()
 def uninstrument_logging(self):
     yield
     uninstrument()
 def uninstrument_requests(self):
     yield
     uninstrument()