Use singleton instance of EventManager

This commit is contained in:
Jamie Bliss 2016-08-27 12:21:15 -04:00
parent 573e78372f
commit ab6501748d
2 changed files with 5 additions and 3 deletions

View file

@ -5,7 +5,7 @@ import xonsh.built_ins
from xonsh.built_ins import ensure_list_of_strs
from xonsh.execer import Execer
from xonsh.tools import XonshBlockError
from xonsh.events import EventManager
from xonsh.events import events
import glob
@ -39,7 +39,8 @@ def xonsh_builtins():
builtins.execx = None
builtins.compilex = None
builtins.aliases = {}
builtins.events = EventManager()
# Unlike all the other stuff, this has to refer to the "real" one because all modules that would be firing events on the global instance.
builtins.events = events
yield builtins
del builtins.__xonsh_env__
del builtins.__xonsh_ctx__

View file

@ -68,7 +68,7 @@ def test_cdpath_expansion(xonsh_builtins):
raise e
def test_cdpath_events(xonsh_builtins, tmpdir):
xonsh_builtins.__xonsh_env__ = Env(CDPATH=PARENT, PWD=HERE)
xonsh_builtins.__xonsh_env__ = Env(CDPATH=PARENT, PWD=os.getcwd())
target = str(tmpdir)
ev = None
@ -77,6 +77,7 @@ def test_cdpath_events(xonsh_builtins, tmpdir):
nonlocal ev
ev = old, new
old_dir = os.getcwd()
try:
dirstack.cd([target])