Open MuriloScarpaSitonio opened 2 years ago
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 https://github.com/pnuckowski/aioresponses/issues/164
simply pass repeat=True
to aioresponses method (in this case get
method) i.e. .get(SOME_URL, status=400, repeat=True)
I just found an answer in another issue #164
simply pass
repeat=True
to aioresponses method (in this caseget
method) i.e..get(SOME_URL, status=400, repeat=True)
Interesting, why this works though o.O I do this and seems working:
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?