typing: MonkeyPatch.context
This commit is contained in:
parent
18ac7e0b79
commit
e25d46aae6
|
@ -4,6 +4,7 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
from typing import Generator
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.fixtures import fixture
|
from _pytest.fixtures import fixture
|
||||||
|
@ -108,7 +109,7 @@ class MonkeyPatch:
|
||||||
self._savesyspath = None
|
self._savesyspath = None
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def context(self):
|
def context(self) -> Generator["MonkeyPatch", None, None]:
|
||||||
"""
|
"""
|
||||||
Context manager that returns a new :class:`MonkeyPatch` object which
|
Context manager that returns a new :class:`MonkeyPatch` object which
|
||||||
undoes any patching done inside the ``with`` block upon exit:
|
undoes any patching done inside the ``with`` block upon exit:
|
||||||
|
|
Loading…
Reference in New Issue