Add context manager to ease using mox right
Bug #1680481 reported by
Martin Häcker
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-mox3 |
New
|
Undecided
|
Unassigned |
Bug Description
Hi there,
using mox3 right would be much easier if it had a context manager like this:
```
@contextmanager
def mox(test_class):
mox = Mox()
yield mox
```
To be used like this in unit test:
```
def test_something(
with mox(self) as mox:
# test code that uses the mocked objects
```
Can you please add that to the library? (Naming is of course something you would have to decide on).
To post a comment you must log in.
ping @maintainers: any word on this?