Example #1
0
 def setup(self):
     os.environ['HOME'] = self.tempdir()
     authtok = os.urandom(16).encode('hex')
     self.config = {
         'debug': True,
         'log_stdout': False,
         'auth_token': authtok
     }
     # XXX: Create a Posix/Windows controller? For now just os.spawnve()
     # and a timeout.
     ctrl = BackendController(self.config)
     cmd, args, env = ctrl.startup_info()
     self.backend_pid = os.spawnve(os.P_NOWAIT, cmd, args, env)
     time.sleep(1)
     addrspec = ctrl.backend_address()
     addr = util.parse_address(addrspec)
     csock = util.create_connection(addr)
     self.connection = MessageBusConnection(csock, authtok)