diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 090bf61d6e9..8aec7b818c8 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -4,6 +4,7 @@ import sys import warnings from contextlib import contextmanager +from typing import Generator import pytest from _pytest.fixtures import fixture @@ -108,7 +109,7 @@ def __init__(self): 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: