Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some deprecations in tests #1647

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions autobahn/asyncio/test/test_aio_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ async def test_echo_async():
assert 'Hello!' == await echo_async('Hello!', 0)


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


@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
@pytest.mark.asyncio
async def test_async_on_connect_server(event_loop):
def test_async_on_connect_server(event_loop):

num = 42
done = txaio.create_future()
Expand Down Expand Up @@ -65,7 +63,8 @@ async def on_connect(req):
b'\r\n', # last string doesn't get a \r\n from join()
])
server.processHandshake()
await done

event_loop.run_until_complete(done)

assert len(values) == 1
assert values[0] == num * num
12 changes: 6 additions & 6 deletions autobahn/wamp/test/test_wamp_component_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
from autobahn.asyncio.component import Component

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

Expand Down Expand Up @@ -72,11 +71,11 @@ def done(f):
txaio.config.loop = orig_loop
assert comp._done_f is None
f.add_done_callback(done)
await finished

event_loop.run_until_complete(finished)

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

event_loop.run_until_complete(finished)
Loading