示例#1
0
文件: globals.py 项目: rm-hull/yalix
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
示例#2
0
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
示例#3
0
 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])
示例#4
0
 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])
示例#5
0
文件: repl.py 项目: rm-hull/yalix
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)
示例#6
0
 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])
示例#7
0
 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])