micro-fan / aiozk

Asyncio client for zookeeper
MIT License
49 stars 20 forks source link

event loop: Use the event loop provided by pytest-asyncio #55

Closed rhdxmr closed 4 years ago

rhdxmr commented 4 years ago

If @pytest.mark.asyncio decorator is used for test methods, the event loop of pytest-asyncio is set as the default asyncio event loop automatically.

ZKClient was initiated without the loop argument and was called while not inside the @pytest.mark.asyncio decorator, so it uses the default asyncio event loop.

Hence, plenty of tests complained that "Future attached to a different loop".

To solve this problem, make ZKClient use event_loop generated by pytest-asyncio instead of default asyncio event loop.

cybergrind commented 4 years ago

:+1: