mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
import builtins
|
|
import pytest
|
|
from tools import DummyShell, sp, XonshBlockError
|
|
from xonsh.tools import ensure_list_of_strs
|
|
import glob
|
|
|
|
|
|
|
|
@pytest.yield_fixture
|
|
def xonsh_builtins():
|
|
builtins.__xonsh_env__ = {}
|
|
builtins.__xonsh_ctx__ = {}
|
|
builtins.__xonsh_shell__ = DummyShell()
|
|
builtins.__xonsh_help__ = lambda x: x
|
|
builtins.__xonsh_glob__ = glob.glob
|
|
builtins.__xonsh_exit__ = False
|
|
builtins.__xonsh_superhelp__ = lambda x: x
|
|
builtins.__xonsh_regexpath__ = lambda x: []
|
|
builtins.__xonsh_expand_path__ = lambda x: x
|
|
builtins.__xonsh_subproc_captured__ = sp
|
|
builtins.__xonsh_subproc_uncaptured__ = sp
|
|
builtins.__xonsh_ensure_list_of_strs__ = ensure_list_of_strs
|
|
builtins.XonshBlockError = XonshBlockError
|
|
builtins.evalx = eval
|
|
builtins.execx = None
|
|
builtins.compilex = None
|
|
builtins.aliases = {}
|
|
yield builtins
|
|
del builtins.__xonsh_env__
|
|
del builtins.__xonsh_ctx__
|
|
del builtins.__xonsh_shell__
|
|
del builtins.__xonsh_help__
|
|
del builtins.__xonsh_glob__
|
|
del builtins.__xonsh_exit__
|
|
del builtins.__xonsh_superhelp__
|
|
del builtins.__xonsh_regexpath__
|
|
del builtins.__xonsh_expand_path__
|
|
del builtins.__xonsh_subproc_captured__
|
|
del builtins.__xonsh_subproc_uncaptured__
|
|
del builtins.__xonsh_ensure_list_of_strs__
|
|
del builtins.XonshBlockError
|
|
del builtins.evalx
|
|
del builtins.execx
|
|
del builtins.compilex
|
|
del builtins.aliases
|
|
|