ionelmc/python-lazy-object-proxy

Non async versions of Proxy classes

diogobaeder opened this issue · 0 comments

Hi folks,

Since the introduction of asyncio-compatible methods in the Proxy class, starting from version 1.6.0 of this library, a bunch of tests for a project I have started breaking. The reason is, I use unittest.mock.patch with an object that is fetched from a Proxy, however now since the Proxy implements coroutine methods the patch function always identifies it as asynchronous, which have the effect of making some of my view functions return a coroutine (an AsyncMock instance) instead of a Response object.

I'd like to suggest that someone creates explicit AsyncProxy and SyncProxy classes to avoid this kind of issue, so that it's clear whether the proxied object should be async-compatible or not.

Thanks!