Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_tests():
tests = os.environ.get("tests", None)
if tests is not None:
with log.nested("running the VM test script"):
try:
exec(tests)
except Exception as e:
eprint("error: {}".format(str(e)))
sys.exit(1)
else:
ptpython.repl.embed(locals(), globals())
# TODO: Collect coverage data
for machine in machines:
if machine.is_up():
machine.execute("sync")
if nr_tests != 0:
log.log("{} out of {} tests succeeded".format(nr_succeeded, nr_tests))
try:
from ptpython import repl, prompt_style
except ImportError:
pass
else:
def configure(repl):
class NagarePrompt(prompt_style.ClassicPrompt):
def in_tokens(self, cli):
return [(prompt_style.Token.Prompt, 'Nagare%s>>> ' % prompt)]
repl.all_prompt_styles['nagare'] = NagarePrompt()
repl.prompt_style = 'nagare'
print banner
repl.embed(
globals(), ns,
history_filename=os.path.expanduser('~/.nagarehistory'),
configure=configure
)
return
try:
from bpython import curtsies, embed
except ImportError:
pass
else:
class FullCurtsiesRepl(curtsies.FullCurtsiesRepl):
def __init__(self, config, *args, **kw):
config.hist_file = os.path.expanduser('~/.nagarehistory')
super(FullCurtsiesRepl, self).__init__(config, *args, **kw)
def embed(*a, **kw):
"""
DEPRECATED. Only for backwards compatibility.
Please call ptpython.repl.embed directly!
"""
ptpython.repl.embed(*a, **kw)
except ImportError as e: