Skip to content

Commit 50b960c

Browse files
nicoddemusRonnyPfannschmidt
authored andcommitted
Add note about not monkey-patching builtins (#1986)
* Add note about not monkey-patching builtins Related to #1985 * Mention -s as well
1 parent d47ae79 commit 50b960c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/en/monkeypatch.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ will delete the method ``request.session.Session.request``
5555
so that any attempts within tests to create http requests will fail.
5656

5757

58+
.. note::
59+
60+
Be advised that it is not recommended to patch builtin functions such as ``open``,
61+
``compile``, etc., because it might break pytest's internals. If that's
62+
unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might
63+
help althought there's no guarantee.
64+
65+
5866
Method reference of the monkeypatch fixture
5967
-------------------------------------------
6068

0 commit comments

Comments
 (0)