Skip to content

Commit a1b8d1e

Browse files
committed
experimental: add monkeysession fixture
Ref: pytest-dev#363
1 parent cbe3e3e commit a1b8d1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/_pytest/monkeypatch.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ def monkeypatch():
3636
mpatch.undo()
3737

3838

39+
@pytest.fixture(scope="session")
40+
def monkeysession(request):
41+
"""Experimental (https://github.com/pytest-dev/pytest/issues/363)."""
42+
from _pytest.monkeypatch import MonkeyPatch
43+
44+
mpatch = MonkeyPatch()
45+
yield mpatch
46+
mpatch.undo()
47+
48+
3949
def resolve(name):
4050
# simplified from zope.dottedname
4151
parts = name.split(".")

0 commit comments

Comments
 (0)