From 0aeaecd3f43be0fc99a342fa2d6f77d9702997b1 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Tue, 19 Apr 2022 21:01:39 +1000 Subject: [PATCH] Add comment for pytest late loading feature This PR seems fine, however lacks a comment for why we would be late loading the main module. Add it so we can merge rather than go back and forwards about a minor comment. --- requests_mock/contrib/_pytest_plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requests_mock/contrib/_pytest_plugin.py b/requests_mock/contrib/_pytest_plugin.py index 6d58c97..bb6cd2b 100644 --- a/requests_mock/contrib/_pytest_plugin.py +++ b/requests_mock/contrib/_pytest_plugin.py @@ -75,6 +75,8 @@ def requests_mock(request): responses for unit testing. See: https://requests-mock.readthedocs.io/en/latest/ """ + # pytest plugins get loaded immediately. If we import requests_mock it + # imports requests and then SSL which prevents gevent patching. Late load. import requests_mock as rm_module case_sensitive = request.config.getini('requests_mock_case_sensitive')