def create_initial_env(): env = Env() with log_progress("Creating initial environment"): bootstrap_special_forms(env) bootstrap_python_functions(env) for lib in __core_libraries__: with log_progress("Loading library: " + lib): bootstrap_lisp_functions(env, "../../core/{0}.ylx".format(lib)) return env
def create_initial_env(): env = Env() with log_progress("Creating initial environment"): bootstrap_special_forms(env) bootstrap_python_functions(env) for lib in __core_libraries__: with log_progress("Loading library: " + lib): bootstrap_lisp_functions(env, "lib/{0}.ylx".format(lib)) return env
def test_log_progress_reports_FAILED(self): with utils.capture() as out: with self.assertRaises(KeyError): with utils.log_progress("Testing log message"): raise KeyError self.assertTrue('Testing log message' in out[0]) self.assertTrue('FAILED' in out[0])
def init_readline(env): try: import readline except ImportError: print("Module readline not available") else: histfile = os.path.join(os.path.expanduser("~"), ".yalix_history") readline.set_completer(Completer(env).complete) readline.set_completer_delims('() ') readline.parse_and_bind("set blink-matching-paren on") readline.parse_and_bind("tab: complete") if hasattr(readline, "read_history_file"): try: with log_progress("Reading history"): readline.read_history_file(histfile) except IOError: pass atexit.register(readline.write_history_file, histfile)
def test_log_progress_reports_DONE(self): with utils.capture() as out: with utils.log_progress("Testing log message"): pass self.assertTrue('Testing log message' in out[0]) self.assertTrue('DONE' in out[0])