From 7e00362e6f3c901f0e7a998bf2849c347151ef5b Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 5 Oct 2016 12:26:37 -0300 Subject: [PATCH 1/2] Add note about not monkey-patching builtins Related to #1985 --- doc/en/monkeypatch.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/en/monkeypatch.rst b/doc/en/monkeypatch.rst index e85d94d6d86..0e112c19ff1 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`` and/or ``--assert=plain`` might help althought + there's no guarantee. + + Method reference of the monkeypatch fixture ------------------------------------------- From 8fd5e09c528f03e73cadbac146695aa47091dd82 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 5 Oct 2016 12:35:42 -0300 Subject: [PATCH 2/2] Mention -s as well --- doc/en/monkeypatch.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/monkeypatch.rst b/doc/en/monkeypatch.rst index 0e112c19ff1..806e910bddc 100644 --- a/doc/en/monkeypatch.rst +++ b/doc/en/monkeypatch.rst @@ -59,8 +59,8 @@ so that any attempts within tests to create http requests will fail. 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`` and/or ``--assert=plain`` might help althought - there's no guarantee. + unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might + help althought there's no guarantee. Method reference of the monkeypatch fixture