-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
When __getattr__
raises an EventsException for a missing attribute, it breaks getattr(obj, name, default)
.
Simple test that reproduces it:
class TestGetattr(TestBase):
def test_getattr(self):
events = Events(('on_event', ))
assert getattr(events, "blah", None) is None
This is a problem for me because in python 3.8, creating a Mock of an object that has events runs into this issue. Here's the corresponding test case for python 3.8:
class TestMocking(TestBase):
def test_mock(self):
class MyEvents(Events):
__events__ = ('on_eventOne', )
_instance = None
MyEvents._instance = MyEvents()
# In python 3.8, this results in "EventsException: Event '_is_coroutine' is not declared"
unittest.mock.Mock(MyEvents)
Metadata
Metadata
Assignees
Labels
No labels