Skip to content

Commit 50dac40

Browse files
committed
remove use of deprecated event_loop fixture
1 parent 68f6a54 commit 50dac40

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

tests/conftest.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ def pytest_collection_modifyitems(items):
4141

4242

4343
@pytest.fixture
44-
async def io_loop(event_loop, request):
44+
async def io_loop(request):
4545
"""Create tornado io_loop on current asyncio event loop"""
4646
if tornado is None:
4747
pytest.skip()
4848
io_loop = IOLoop.current()
49-
assert asyncio.get_event_loop() is event_loop
50-
assert io_loop.asyncio_loop is event_loop
49+
assert io_loop.asyncio_loop is asyncio.get_running_loop()
5150

5251
def _close():
5352
io_loop.close(all_fds=True)
@@ -70,15 +69,6 @@ def term_context(ctx, timeout):
7069
)
7170

7271

73-
@pytest.fixture
74-
def event_loop():
75-
loop = asyncio.new_event_loop()
76-
yield loop
77-
loop.close()
78-
# make sure selectors are cleared
79-
assert dict(zmq.asyncio._selectors) == {}
80-
81-
8272
@pytest.fixture
8373
def sigalrm_timeout():
8474
"""Set timeout using SIGALRM

tests/test_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
@pytest.fixture
20-
def Context(event_loop):
20+
async def Context():
2121
return zaio.Context
2222

2323

tests/test_auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
@pytest.fixture
26-
def Context(event_loop):
26+
async def Context():
2727
return zmq.asyncio.Context
2828

2929

@@ -93,7 +93,7 @@ def certs(secret_keys_dir):
9393

9494

9595
@pytest.fixture
96-
async def _async_setup(request, event_loop):
96+
async def _async_setup(request):
9797
"""pytest doesn't support async setup/teardown"""
9898
instance = request.instance
9999
await instance.async_setup()
@@ -407,7 +407,7 @@ def make_auth(self):
407407
return AsyncioAuthenticator(self.context)
408408

409409

410-
async def test_ioloop_authenticator(context, event_loop, io_loop):
410+
async def test_ioloop_authenticator(context, io_loop):
411411
from tornado.ioloop import IOLoop
412412

413413
with warnings.catch_warnings():

tests/test_monitor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# Copyright (C) PyZMQ Developers
22
# Distributed under the terms of the Modified BSD License.
33

4+
import pytest
5+
46
import zmq
57
import zmq.asyncio
68
from zmq.utils.monitor import recv_monitor_message
79
from zmq_test_utils import require_zmq_4
810

911
pytestmark = require_zmq_4
10-
import pytest
1112

1213

1314
@pytest.fixture(params=["zmq", "asyncio"])
14-
def Context(request, event_loop):
15+
async def Context(request):
1516
if request.param == "asyncio":
1617
return zmq.asyncio.Context
1718
else:

0 commit comments

Comments
 (0)