mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
hot fix for pytest events
This commit is contained in:
parent
78a87d0304
commit
5985c3d33b
2 changed files with 6 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue