Make sure `monkeypatch.undo()` is always called
This commit is contained in:
parent
6e7dc8bac8
commit
303b6e32ea
|
@ -45,9 +45,8 @@ def monkeypatch() -> Generator["MonkeyPatch", None, None]:
|
|||
fixture has finished. The ``raising`` parameter determines if a KeyError
|
||||
or AttributeError will be raised if the set/deletion operation has no target.
|
||||
"""
|
||||
mpatch = MonkeyPatch()
|
||||
yield mpatch
|
||||
mpatch.undo()
|
||||
with MonkeyPatch.context() as mpatch:
|
||||
yield mpatch
|
||||
|
||||
|
||||
def resolve(name: str) -> object:
|
||||
|
|
Loading…
Reference in New Issue