예제 #1
0
def ctx():
    """Context in which the ptk multiline functionality will be tested."""
    builtins.__xonsh_env__ = DummyEnv()
    builtins.__xonsh_env__['INDENT'] = '    '
    from xonsh.ptk2.key_bindings import carriage_return
    ptk_buffer = Buffer()
    ptk_buffer.accept_action = MagicMock(name='accept')
    cli = MagicMock(name='cli', spec=Application)
    yield Context(indent='    ',
                  buffer=ptk_buffer,
                  accept=ptk_buffer.accept_action,
                  cli=cli,
                  cr=carriage_return)
    del builtins.__xonsh_env__
예제 #2
0
def ctx():
    """Context in which the ptk multiline functionality will be tested."""
    builtins.__xonsh_env__ = DummyEnv()
    builtins.__xonsh_env__['INDENT'] = '    '
    from xonsh.ptk.key_bindings import carriage_return
    ptk_buffer = Buffer()
    ptk_buffer.accept_action = MagicMock(name='accept', spec=AcceptAction)
    cli = MagicMock(name='cli', spec=CommandLineInterface)
    yield Context(indent='    ',
                  buffer=ptk_buffer,
                  accept=ptk_buffer.accept_action,
                  cli=cli,
                  cr=carriage_return)
    del builtins.__xonsh_env__
예제 #3
0
def ctx(xession):
    """Context in which the ptk multiline functionality will be tested."""
    xession.env["INDENT"] = "    "
    from xonsh.ptk_shell.key_bindings import carriage_return

    ptk_buffer = Buffer()
    ptk_buffer.accept_action = MagicMock(name="accept")
    cli = MagicMock(name="cli", spec=Application)
    yield Context(
        indent="    ",
        buffer=ptk_buffer,
        accept=ptk_buffer.accept_action,
        cli=cli,
        cr=carriage_return,
    )
예제 #4
0
def ctx():
    """Context in which the ptk multiline functionality will be tested."""
    builtins.__xonsh__ = XonshSession()
    builtins.__xonsh__.env = DummyEnv()
    builtins.__xonsh__.env["INDENT"] = "    "
    from xonsh.ptk2.key_bindings import carriage_return

    ptk_buffer = Buffer()
    ptk_buffer.accept_action = MagicMock(name="accept")
    cli = MagicMock(name="cli", spec=Application)
    yield Context(
        indent="    ",
        buffer=ptk_buffer,
        accept=ptk_buffer.accept_action,
        cli=cli,
        cr=carriage_return,
    )
    del builtins.__xonsh__.env
    del builtins.__xonsh__
예제 #5
0
def ctx():
    """Context in which the ptk multiline functionality will be tested."""
    builtins.__xonsh__ = XonshSession()
    builtins.__xonsh__.env = DummyEnv()
    builtins.__xonsh__.env["INDENT"] = "    "
    from xonsh.ptk2.key_bindings import carriage_return

    ptk_buffer = Buffer()
    ptk_buffer.accept_action = MagicMock(name="accept")
    cli = MagicMock(name="cli", spec=Application)
    yield Context(
        indent="    ",
        buffer=ptk_buffer,
        accept=ptk_buffer.accept_action,
        cli=cli,
        cr=carriage_return,
    )
    del builtins.__xonsh__.env
    del builtins.__xonsh__
예제 #6
0
def setup():
    global indent_
    global buffer
    global bufaccept
    global cli
    global carriage_return
    global builtins

    import builtins

    builtins.__xonsh_env__ = Env()
    builtins.__xonsh_env__['INDENT'] = '    '

    from xonsh.ptk.key_bindings import carriage_return

    indent_ = '    '
    buffer = Buffer()
    bufaccept = MagicMock(name='accept', spec=AcceptAction)
    cli = MagicMock(name='cli', spec=CommandLineInterface)
    buffer.accept_action = bufaccept
예제 #7
0
def setup():
    global indent_
    global buffer
    global bufaccept
    global cli
    global carriage_return
    global builtins
    
    import builtins

    builtins.__xonsh_env__ = Env()
    builtins.__xonsh_env__['INDENT'] = '    '

    from xonsh.ptk.key_bindings import carriage_return

    indent_ = '    '
    buffer = Buffer()
    bufaccept = MagicMock(name='accept', spec=AcceptAction)
    cli = MagicMock(name='cli', spec=CommandLineInterface)
    buffer.accept_action = bufaccept