示例#1
0
    def test_patch_unpatch(self):
        tracer = get_dummy_tracer()
        writer = tracer.writer
        url = "%s:%s" % (cfg["host"], cfg["port"])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(
            service=self.TEST_SERVICE,
            tracer=tracer).onto(client)

        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set("a", 1)

        spans = writer.pop()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=tracer).onto(client)
        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)
示例#2
0
    def test_patch_unpatch(self):
        tracer = get_dummy_tracer()
        writer = tracer.writer
        url = "%s:%s" % (cfg["host"], cfg["port"])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(service=self.TEST_SERVICE,
                                   tracer=tracer).onto(client)

        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set("a", 1)

        spans = writer.pop()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=tracer).onto(client)
        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)
示例#3
0
    def test_patch_unpatch(self):
        url = '%s:%s' % (cfg['host'], cfg['port'])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(
            service=self.TEST_SERVICE,
            tracer=self.tracer).onto(client)

        client.set('a', 1)

        spans = self.tracer.writer.pop()
        assert spans, spans
        assert len(spans) == 1

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set('a', 1)

        spans = self.tracer.writer.pop()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(client)
        client.set('a', 1)

        spans = self.tracer.writer.pop()
        assert spans, spans
        assert len(spans) == 1
示例#4
0
    def test_patch_unpatch(self):
        url = "%s:%s" % (cfg["host"], cfg["port"])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(service=self.TEST_SERVICE,
                                   tracer=self.tracer).onto(client)

        client.set("a", 1)

        spans = self.pop_spans()
        assert spans, spans
        assert len(spans) == 1

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set("a", 1)

        spans = self.pop_spans()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(client)
        client.set("a", 1)

        spans = self.pop_spans()
        assert spans, spans
        assert len(spans) == 1
示例#5
0
文件: test.py 项目: depop/dd-trace-py
 def tearDown(self):
     unpatch()
     super(TestPylibmcPatchDefault, self).tearDown()
示例#6
0
 def tearDown(self):
     unpatch()
示例#7
0
 def tearDown(self):
     unpatch()