From 1ffcb9224f8d3ec42b037d63793d17c4da4d3084 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 6 Aug 2022 00:08:10 +0200 Subject: [PATCH] Mention `monkeypatch.undo()` in the docs --- src/_pytest/monkeypatch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 91d590fb3..08f958b9b 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -42,7 +42,8 @@ def monkeypatch() -> Generator["MonkeyPatch", None, None]: monkeypatch.chdir(path) All modifications will be undone after the requesting test function or - fixture has finished. The ``raising`` parameter determines if a KeyError + fixture has finished. It is possible to undo them earlier by calling + ``monkeypatch.undo()``. The ``raising`` parameter determines if a KeyError or AttributeError will be raised if the set/deletion operation has no target. """ mpatch = MonkeyPatch()