def generate_environment():
global TMP_PATH<EOL>TMP_PATH = tempfile.mkdtemp()<EOL>zeo_conf_path = os.path.join(TMP_PATH, "<STR_LIT>")<EOL>with open(zeo_conf_path, "<STR_LIT:w>") as f:<EOL><INDENT>f.write(<EOL>Template(data_context("<STR_LIT>")).substitute(<EOL>path=TMP_PATH,<EOL>server=ZEO_SERVER,<EOL>port=ZEO_PORT,<EOL>)<EOL>)<EOL><DEDENT>client_config_path = os.path.join(TMP_PATH, "<STR_LIT>")<EOL>with open(client_config_path, "<STR_LIT:w>") as f:<EOL><INDENT>f.write(<EOL>Template(data_context("<STR_LIT>")).substitute(<EOL>server=ZEO_SERVER,<EOL>port=ZEO_PORT,<EOL>)<EOL>)<EOL><DEDENT>def run_zeo():<EOL><INDENT>global SERV<EOL>SERV = subprocess.Popen(["<STR_LIT>", "<STR_LIT>", zeo_conf_path])<EOL><DEDENT>serv = threading.Thread(target=run_zeo)<EOL>serv.setDaemon(True)<EOL>serv.start()<EOL>
Generate the environment in ``/tmp`` and run the ZEO server process in
another thread.