typing: MonkeyPatch.context

This commit is contained in:
Daniel Hahler
2020-01-28 21:44:12 +01:00
parent 18ac7e0b79
commit e25d46aae6

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: