-
Notifications
You must be signed in to change notification settings - Fork 86
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
How to mock multiple requests with asyncio.gather
?
#205
Comments
Any updates on this issue? I am also trying to make simultaneous requests and getting the same error. |
Hey, I would also like to know if there is any nice solution to this issue? |
I just found an answer in another issue #164 simply pass |
Interesting, why this works though o.O mocked.get(re.compile('.+index_price.+'),
payload=expected_index_price_dict,
repeat=True)
mocked.get(re.compile('.+fair_price.+'),
payload=expected_fair_price_dict,
repeat=True)
# ...
await asyncio.gather(index_price(symbol),
fair_price(symbol),
return_exceptions=True) |
I have a piece of code which uses
asyncio.gather
to make simultaneous requests:In my tests I'm trying to simulate some scenarios by mocking the requests status:
If I run a single test, it works as expected but if I run more than one (and the others don't even have to use
mock_aioresponse
) I start to get someConnection refused
errors.How can I use
aioresponses
to accomplish my test cases?The text was updated successfully, but these errors were encountered: