Beispiel #1
0
def main():
    os.environ['SMASH'] = '1'
    hijack_ipython_module()
    # imports below must come after hijack
    from smashlib import embed
    from smashlib.config import SmashConfig, SmashUserConfig
    smash_prof = SmashConfig.ensure()['profile']
    SmashUserConfig.ensure()
    embed(["--profile-dir={0}".format(smash_prof), ],
          # do not let smash inspect the caller context
          # and automatically update globals/locals
          user_ns=None
          )
Beispiel #2
0
def embed(argv=tuple(), **kargs):
    hijack_ipython_module()
    # if os.environ.get('SMASH', None):
    #    print "..detected nesting.. this may cause problems"
    context = kargs.pop('user_ns', {})
    caller_context = get_caller(2)
    if context is not None:
        context.update(caller_context['globals'])
        context.update(caller_context['locals'])
    if '--no-confirm-exit' not in argv:
        argv = ['--no-confirm-exit'] + list(argv)
    try:
        start_ipython(argv=argv, user_ns=context, **kargs)
    except KeyboardInterrupt:
        pass
Beispiel #3
0
""" smashlib.testing

    Base classes, etc for smashlib's tests.

    Note: The tests themselves are in the source
          root, not inside the smashlib package
"""
import unittest
from smashlib.import_hooks import hijack_ipython_module
hijack_ipython_module()

main = unittest.main


class TestCase(unittest.TestCase):
    pass