Merge pull request #6606 from blueyed/typing-monkeypatch-context

typing: MonkeyPatch.context
This commit is contained in:
Daniel Hahler
2020-01-29 00:12:53 +01:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ import re
import sys
import warnings
from contextlib import contextmanager
from typing import Generator
import pytest
from _pytest.fixtures import fixture
@@ -108,7 +109,7 @@ class MonkeyPatch:
self._savesyspath = None
@contextmanager
def context(self):
def context(self) -> Generator["MonkeyPatch", None, None]:
"""
Context manager that returns a new :class:`MonkeyPatch` object which
undoes any patching done inside the ``with`` block upon exit: