Skip to content

Commit d476726

Browse files
committed
⬆️(project) upgrade anyio and fix related websocket test issues
Upgrades AnyIO to its most recent release and resolves broken WebSocket tests.
1 parent e8873e7 commit d476726

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ cli = [
8888
"sentry-sdk[fastapi]>=1.9.0",
8989
]
9090
dev = [
91-
"anyio==4.4.0",
91+
"anyio==4.9.0",
9292
"black==24.8.0",
9393
"cryptography==43.0.1",
9494
"factory-boy==3.3.1",

tests/fixtures/backends.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ def events():
884884

885885
@pytest.mark.anyio
886886
@pytest.fixture
887-
async def ws(events):
887+
async def ws(events, anyio_backend): # https://github.com/agronholm/anyio/issues/803
888888
"""Return a websocket server instance."""
889889

890890
async def forward(websocket):

tests/test_cli.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from ralph.exceptions import BackendParameterException, ConfigurationException
2828
from ralph.models.edx.navigational.statements import UIPageClose
2929
from ralph.models.xapi.navigation.statements import PageTerminated
30-
from ralph.utils import iter_over_async
30+
from ralph.utils import execute_async
3131

3232
from tests.factories import mock_instance
3333
from tests.fixtures.backends import (
@@ -48,16 +48,14 @@ def test_cli_comma_separated_key_value_param_type():
4848
with pytest.raises(
4949
BadParameter,
5050
match=(
51-
"You should provide key=value pairs separated by commas, "
52-
"e.g. foo=bar,bar=2"
51+
"You should provide key=value pairs separated by commas, e.g. foo=bar,bar=2"
5352
),
5453
):
5554
param_type.convert("foo=bar,baz", None, None)
5655
with pytest.raises(
5756
BadParameter,
5857
match=(
59-
"You should provide key=value pairs separated by commas, "
60-
"e.g. foo=bar,bar=2"
58+
"You should provide key=value pairs separated by commas, e.g. foo=bar,bar=2"
6159
),
6260
):
6361
param_type.convert("foo=bar,", None, None)
@@ -160,10 +158,7 @@ def test_cli_help_option():
160158

161159
assert result.exit_code == 0
162160
assert (
163-
(
164-
"-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO (default) or "
165-
"DEBUG"
166-
)
161+
"-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO (default) or DEBUG"
167162
) in result.output
168163

169164

@@ -766,7 +761,7 @@ def test_cli_read_command_with_ws_backend(events, ws):
766761
# async context, thus we wrap it into a sync contextmanager.
767762
@contextmanager
768763
def websocket():
769-
yield from iter_over_async(ws)
764+
yield execute_async(ws)
770765

771766
with websocket():
772767
runner = CliRunner()

0 commit comments

Comments
 (0)