예제 #1
0
def test_load_static_config(s, exp, loaded, tmpdir, xonsh_builtins):
    env = Env({'XONSH_SHOW_TRACEBACK': False})
    xonsh_builtins.__xonsh_env__ = env
    f = tmpdir.join('test_static_config')
    f.write(s)
    conf = load_static_config(env, str(f))
    assert exp == conf
    assert env['LOADED_CONFIG'] == loaded
예제 #2
0
def check_load_static_config(s, exp, loaded):
    env = {'XONSH_SHOW_TRACEBACK': False}
    with tempfile.NamedTemporaryFile() as f, mock_xonsh_env(env):
        f.write(s)
        f.flush()
        conf = load_static_config(env, f.name)
    assert_equal(exp, conf)
    assert_equal(env['LOADED_CONFIG'], loaded)
예제 #3
0
def test_load_static_config(s, exp, loaded, tmpdir, xonsh_builtins):
    env = Env({'XONSH_SHOW_TRACEBACK': False})
    xonsh_builtins.__xonsh_env__ = env
    f = tmpdir.join('test_static_config')
    f.write(s)
    conf = load_static_config(env, str(f))
    assert exp == conf
    assert env['LOADED_CONFIG'] == loaded
예제 #4
0
def check_load_static_config(s, exp, loaded):
    env = {'XONSH_SHOW_TRACEBACK': False}
    with tempfile.NamedTemporaryFile() as f, mock_xonsh_env(env):
        f.write(s)
        f.flush()
        conf = load_static_config(env, f.name)
    assert_equal(exp, conf)
    assert_equal(env['LOADED_CONFIG'], loaded)
예제 #5
0
def check_load_static_config(s, exp, loaded):
    env = Env({'XONSH_SHOW_TRACEBACK': False})
    f = tempfile.NamedTemporaryFile(delete=False)
    with mock_xonsh_env(env):
        f.write(s)
        f.close()
        conf = load_static_config(env, f.name)
    os.unlink(f.name)
    assert_equal(exp, conf)
    assert_equal(env['LOADED_CONFIG'], loaded)
예제 #6
0
def _get_shells(shells=None, config=None, issue_warning=True):
    if shells is not None and config is not None:
        raise RuntimeError('Only one of shells and config may be non-None.')
    elif shells is not None:
        pass
    else:
        env = getattr(builtins, '__xonsh_env__', os.environ)
        if env.get('LOADED_CONFIG', False):
            conf = builtins.__xonsh_config__
        else:
            from xonsh.environ import load_static_config
            conf = load_static_config(env, config)
        shells = conf.get('foreign_shells', ())
    return shells
예제 #7
0
def _get_shells(shells=None, config=None, issue_warning=True):
    if shells is not None and config is not None:
        raise RuntimeError('Only one of shells and config may be non-None.')
    elif shells is not None:
        pass
    else:
        env = getattr(builtins, '__xonsh_env__', os.environ)
        if env.get('LOADED_CONFIG', False):
            conf = builtins.__xonsh_config__
        else:
            from xonsh.environ import load_static_config
            conf = load_static_config(env, config)
        shells = conf.get('foreign_shells', ())
    return shells