summaryrefslogtreecommitdiff
path: root/changelog
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-11-09 11:45:38 +0200
committerGitHub <noreply@github.com>2020-11-09 11:45:38 +0200
commite986d84466dfa98dbbc55cc1bf5fcb99075f4ac3 (patch)
treef2e1e2e8afebad698ca7d6e19d16eb782dad987a /changelog
parent7aa5e49fc412b0675bd4d019d99613556469a2a5 (diff)
parent6f13d1b03b1e1af7def99505234075878407767d (diff)
downloadpytest-e986d84466dfa98dbbc55cc1bf5fcb99075f4ac3.tar.gz
Merge pull request #8006 from bluetech/export-MonkeyPatch
Export MonkeyPatch as pytest.MonkeyPatch
Diffstat (limited to 'changelog')
-rw-r--r--changelog/8006.feature.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/changelog/8006.feature.rst b/changelog/8006.feature.rst
new file mode 100644
index 000000000..0203689ba
--- /dev/null
+++ b/changelog/8006.feature.rst
@@ -0,0 +1,8 @@
+It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``,
+in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it
+from the private `_pytest.monkeypatch.MonkeyPatch` namespace.
+
+Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod,
+and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use
+``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly
+is not ``undo()``-ed automatically.