ENH: ensure we use custom adapters if mounted.

This allows responses to be used with custom adapters.

Tested on 2.7 with requests 2.4.1
Le 19 sept. 2014 19:25, "David Cramer" <notifications@github.com> a écrit :
>
> In responses.py:
>
> > @@ -218,7 +218,9 @@ def _on_request(self, request, **kwargs):
> >
> >      def start(self):
> >          import mock
> > -        self._patcher = mock.patch('requests.Session.send',
self._on_request)
> > +        def callback(session, requests, *a, **kwargs):
>
> But on_request is being called identically unless there's magic I'm
missing. It literally binds self to self._on_request, so when it's called
it'd be called with the additional arguments.
>
> Does it simply not work if you pass ._on_request instead of callback?
>
> I'm just confused why this would change behavior since AFAIK this is
identical from Python's POV

It would be if not for the mocking: when _on_request is called, self is
bound to the RequestsMock instance, not Session. Callback is a terible name
though, let me think about something better.

David
> —
> Reply to this email directly or view it on GitHub.