Closed purplesmoke05 closed 4 weeks ago
The web3 module caches and retains aiohttp.Client
within it. (link)
And the aiohttp.Client
holds the running event loop as its private variable at the time of the object's creation. (link)
Additionally, pytest-asyncio
uses different event loops at the session and function levels.
https://pytest-asyncio.readthedocs.io/en/latest/concepts.html#asyncio-event-loops
Therefore, in pytest, if async_web3 is used at the session level and subsequently at the function level, the event loops do not match, leading to improper execution of requests.
To avoid this, it is necessary to delete cache of aiohttp.Client
held by web3 in the function-level fixture.
Is your feature request related to a problem? Please describe.
Currently, our unit tests create test data on
ganache
(a blockchain simulator) by executing numerous blockchain requests before running test cases. These requests are executed sequentially, resulting in a significant amount of time being spent on test data creation.Describe the solution you'd like
To reduce the time required for test data creation, inplement asynchronous execution of these requests.