#3290 Fix doc
This commit is contained in:
parent
97be076f29
commit
a4daac7eb0
|
@ -62,6 +62,17 @@ so that any attempts within tests to create http requests will fail.
|
||||||
unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might
|
unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might
|
||||||
help although there's no guarantee.
|
help although there's no guarantee.
|
||||||
|
|
||||||
|
To avoid damage of pytest from patching python stdlib functions use ``with``
|
||||||
|
construction::
|
||||||
|
|
||||||
|
# content of test_module.py
|
||||||
|
|
||||||
|
import functools
|
||||||
|
def test_partial(monkeypatch):
|
||||||
|
with monkeypatch.context() as m:
|
||||||
|
m.setattr(functools, "partial", 3)
|
||||||
|
assert functools.partial == 3
|
||||||
|
|
||||||
|
|
||||||
.. currentmodule:: _pytest.monkeypatch
|
.. currentmodule:: _pytest.monkeypatch
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue