File tree 1 file changed +4
-0
lines changed
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ functionality in tests:
25
25
monkeypatch.delenv(name, raising = True )
26
26
monkeypatch.syspath_prepend(path)
27
27
monkeypatch.chdir(path)
28
+ monkeypatch.context()
28
29
29
30
All modifications will be undone after the requesting
30
31
test function or fixture has finished. The ``raising ``
@@ -55,6 +56,9 @@ during a test.
55
56
5. Use :py:meth: `monkeypatch.syspath_prepend <MonkeyPatch.syspath_prepend> ` to modify ``sys.path `` which will also
56
57
call ``pkg_resources.fixup_namespace_packages `` and :py:func: `importlib.invalidate_caches `.
57
58
59
+ 6. Use :py:meth: `monkeypatch.context <MonkeyPatch.context> ` to apply patches only in a specific scope, which can help
60
+ control teardown of complex fixtures or patches to the stdlib.
61
+
58
62
See the `monkeypatch blog post `_ for some introduction material
59
63
and a discussion of its motivation.
60
64
You can’t perform that action at this time.
0 commit comments