Skip to content

Commit 7bc85b3

Browse files
authored
fix some deprecations in tests (#1647)
1 parent f38f16b commit 7bc85b3

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

autobahn/asyncio/test/test_aio_websocket.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ async def test_echo_async():
2121
assert 'Hello!' == await echo_async('Hello!', 0)
2222

2323

24-
# @pytest.mark.asyncio(forbid_global_loop=True)
2524
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
2625
def test_websocket_custom_loop(event_loop):
2726
factory = WebSocketServerFactory(loop=event_loop)
@@ -31,8 +30,7 @@ def test_websocket_custom_loop(event_loop):
3130

3231

3332
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
34-
@pytest.mark.asyncio
35-
async def test_async_on_connect_server(event_loop):
33+
def test_async_on_connect_server(event_loop):
3634

3735
num = 42
3836
done = txaio.create_future()
@@ -65,7 +63,8 @@ async def on_connect(req):
6563
b'\r\n', # last string doesn't get a \r\n from join()
6664
])
6765
server.processHandshake()
68-
await done
66+
67+
event_loop.run_until_complete(done)
6968

7069
assert len(values) == 1
7170
assert values[0] == num * num

autobahn/wamp/test/test_wamp_component_aio.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
from autobahn.asyncio.component import Component
3535

3636
@pytest.mark.skipif(sys.version_info < (3, 5), reason="requires Python 3.5+")
37-
@pytest.mark.asyncio(forbid_global_loop=True)
38-
async def test_asyncio_component(event_loop):
37+
def test_asyncio_component(event_loop):
3938
orig_loop = txaio.config.loop
4039
txaio.config.loop = event_loop
4140

@@ -72,11 +71,11 @@ def done(f):
7271
txaio.config.loop = orig_loop
7372
assert comp._done_f is None
7473
f.add_done_callback(done)
75-
await finished
74+
75+
event_loop.run_until_complete(finished)
7676

7777
@pytest.mark.skipif(sys.version_info < (3, 5), reason="requires Python 3.5+")
78-
@pytest.mark.asyncio(forbid_global_loop=True)
79-
async def test_asyncio_component_404(event_loop):
78+
def test_asyncio_component_404(event_loop):
8079
"""
8180
If something connects but then gets aborted, it should still try
8281
to re-connect (in real cases this could be e.g. wrong path,
@@ -151,4 +150,5 @@ def done(f):
151150
finished.set_result(None)
152151
txaio.config.loop = orig_loop
153152
f.add_done_callback(done)
154-
await finished
153+
154+
event_loop.run_until_complete(finished)

0 commit comments

Comments
 (0)