def test_unix_server(self): factory = ProtocolFactory() factory.protocol = Protocol server = UnixServer(loop, factory, "bogus") server = None # path should be cleaned up as soon as garbage collected gc.collect() self.assertTrue(not os.path.exists("bogus"))
def __init__(self, loop, path, files_cb): factory = ProtocolFactory() factory.protocol = WatchmanProtocol UnixClient.__init__(self, loop, factory, path) self.factory = factory self.path = path self.loop = loop self.files_cb = files_cb
def test_lose_connection(self): factory = ProtocolFactory() factory.protocol = Protocol p = factory.build(loop) self.assertTrue(isinstance(p, Protocol)) t = MockTransport() p.make_connection(t, 'test') p.lose_connection() self.assertTrue(t.closes==1)
def test_tcp_server(self): factory = ProtocolFactory() factory.protocol = Protocol server = TcpServer(loop, factory, "0.0.0.0", 2000) server = None
def test_factory_build(self): factory = ProtocolFactory() factory.protocol = Protocol p = factory.build(loop) self.assertTrue(isinstance(p, Protocol))
def test_factory(self): factory = ProtocolFactory()
def __init__(self): ProtocolFactory.__init__(self) self.builds = 0
def __init__(self, dispatch=Dispatch()): ProtocolFactory.__init__(self) self.dispatch = dispatch self.protocol = MsgPackProtocol self.protocols = []
def test_unix_client(self): factory = ProtocolFactory() factory.protocol = Protocol client = UnixClient(loop, MockFactory(), "bogus")
def test_tcp_client(self): factory = ProtocolFactory() factory.protocol = Protocol client = TcpClient(loop, MockFactory(), "0.0.0.0", 2000)
def __init__(self, dispatch=Dispatch()): ProtocolFactory.__init__(self) self.dispatch = dispatch self.protocol = PickleProtocol self.protocols = []