Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non async versions of Proxy classes #59

Open
diogobaeder opened this issue Oct 28, 2021 · 0 comments
Open

Non async versions of Proxy classes #59

diogobaeder opened this issue Oct 28, 2021 · 0 comments

Comments

@diogobaeder
Copy link

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!

@ionelmc ionelmc changed the title Proxy not playing well with mock patching and Django Non async versions of Proxy classes Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant