def test_call_tween(self):
        clients = []

        def dummy_handler(request):
            from perfmetrics import statsd_client
            clients.append(statsd_client())
            return 'ok!'

        registry = self._make_registry('statsd://localhost:9999')
        tween = self._call(dummy_handler, registry)
        response = tween(object())
        self.assertEqual(response, 'ok!')
        self.assertEqual(len(clients), 1)
        from perfmetrics.statsd import StatsdClient
        self.assertIsInstance(clients[0], StatsdClient)
 def _call(self, handler, registry):
     from perfmetrics import tween
     return tween(handler, registry)