From 50b960c1f065e4ead2343bb266433c6cec594b42 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 5 Oct 2016 12:57:40 -0300 Subject: [PATCH] Add note about not monkey-patching builtins (#1986) * Add note about not monkey-patching builtins Related to #1985 * Mention -s as well --- doc/en/monkeypatch.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/en/monkeypatch.rst b/doc/en/monkeypatch.rst index e85d94d6d..806e910bd 100644 --- a/doc/en/monkeypatch.rst +++ b/doc/en/monkeypatch.rst @@ -55,6 +55,14 @@ will delete the method ``request.session.Session.request`` so that any attempts within tests to create http requests will fail. +.. note:: + + Be advised that it is not recommended to patch builtin functions such as ``open``, + ``compile``, etc., because it might break pytest's internals. If that's + unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might + help althought there's no guarantee. + + Method reference of the monkeypatch fixture -------------------------------------------