hot fix for pytest events

This commit is contained in:
Anthony Scopatz 2016-08-28 10:32:10 -04:00
parent 78a87d0304
commit 5985c3d33b
2 changed files with 6 additions and 5 deletions

View file

@ -111,5 +111,7 @@ def test_transmogrify_by_string(events):
assert inspect.getdoc(events.on_test) == docstring
def test_typos(xonsh_builtins):
for ev in vars(xonsh_builtins.events).values():
for name, ev in vars(xonsh_builtins.events).items():
if 'pytest' in name:
continue
assert inspect.getdoc(ev)

View file

@ -231,11 +231,10 @@ class EventManager:
newevent.add(handler)
def __getattr__(self, name):
"""
Get an event, if it doesn't already exist.
"""
"""Get an event, if it doesn't already exist."""
# This is only called if the attribute doesn't exist, so create the Event...
e = type(name, (Event,), {'__doc__': None})() # (A little bit of magic to enable docstrings to work right)
# (A little bit of magic to enable docstrings to work right)
e = type(name, (Event,), {'__doc__': None})()
# ... and save it.
setattr(self, name, e)
# Now it exists, and we won't be called again.