def test_client_server(self): Mserver.FIFOServer(opts={'open': True}) Mclient.FIFOClient(opts={'open': os.getpid()}) self.assertTrue(True, 'FIXME: need to add a test here.') # FIXME need to use threading or forking # for line in ['one', 'two', 'three']: # server.writeline(line) # self.assertEqual(line, client.readline()) # pass # for line in ['four', 'five', 'six']: # client.writeline(line) # self.assertEqual(line, server.readline()) # pass return
def __init__(self, inout=None, out=None, connection_opts={}): atexit.register(self.finalize) opts = DEFAULT_INIT_CONNECTION_OPTS.copy() opts.update(connection_opts) self.inout = None # initialize in case assignment below fails if inout: self.inout = inout else: self.server_type = opts['IO'] if 'FIFO' == self.server_type: self.inout = Mfifoserver.FIFOServer() else: self.inout = Mtcpserver.TCPServer(opts=opts) pass pass # For Compatability self.output = self.inout self.input = self.inout self.interactive = True # Or at least so we think initially self.histfile = None return
def __init__(self, inout=None, out=None, connection_opts=None): get_option = lambda key: \ Mmisc.option_set(connection_opts, key, self.DEFAULT_INIT_CONNECTION_OPTS) atexit.register(self.finalize) self.inout = None # initialize in case assignment below fails if inout: self.inout = inout else: self.server_type = get_option('IO') if 'FIFO' == self.server_type: self.inout = Mfifoserver.FIFOServer() else: self.inout = Mtcpserver.TCPServer(opts=connection_opts) pass pass # For Compatability self.output = inout self.input = inout self.interactive = True # Or at least so we think initially self.histfile = None return