-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
I'm trying to use doubles with a class that uses the @contextmanager decorator on a method: https://docs.python.org/2/library/contextlib.html
However, this fails because __enter__ and __exit__ are not properly handled on the double. Any way to add this functionality to doubles? Or am I holding it wrong?
I would expect something like this to work:
from contextlib import contextmanager
from doubles import expect, ObjectDouble
class Stats(object):
@contextmanager
def timed(self, key):
pass
def test__timed_does_stuff():
d = ObjectDouble(Stats())
expect(d).timed.once()
with d.timed('mykey'):
passReactions are currently unavailable