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
commit 4ff90b1fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

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: