def test_factory(self): c = Config({}, service_name='x') assert callable(c.tchannel_factory) assert c.tchannel_factory() is None with self.assertRaises(ValueError): c = Config({'tchannel_factory': 'opentracing.tracer'}, service_name='x') c.tchannel_factory() cfg = {'tchannel_factory': 'tchannel.singleton.TChannel.get_instance'} c = Config(cfg, service_name='x') assert callable(c.tchannel_factory) with self.assertRaises(ImportError): cfg = {'tchannel_factory': 'tchannel.singleton.WrongTChannel.get_instance'} Config(cfg, service_name='x')
def test_tchannel_factory(self): c = Config({}, service_name='x') assert callable(c.tchannel_factory) assert c.tchannel_factory() is None c = Config( {'tchannel_factory': 'tchannel.singleton.TChannel.get_instance'}, service_name='x') assert callable(c.tchannel_factory)