Skip to content

Commit

Permalink
fix: Temporarily define a fixed testing event loop (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidizheng authored Jun 30, 2020
1 parent 68d68ae commit 2d22d91
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/system/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@
import grpc
from grpc.experimental import aio

_test_event_loop = asyncio.new_event_loop()

# NOTE(lidiz) We must override the default event_loop fixture from
# pytest-asyncio. pytest fixture frees resources once there isn't any reference
# to it. So, the event loop might close before tests finishes. In the
# customized version, we don't close the event loop.


@pytest.fixture
def event_loop():
loop = asyncio.get_event_loop()
return loop
asyncio.set_event_loop(_test_event_loop)
return asyncio.get_event_loop()


dir = os.path.dirname(__file__)
Expand Down

0 comments on commit 2d22d91

Please sign in to comment.