diff --git a/tests/middleware/__init__.py b/tests/middleware/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/protocols/__init__.py b/tests/protocols/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/protocols/test_http.py b/tests/protocols/test_http.py index 60768346a..b3b060b0f 100644 --- a/tests/protocols/test_http.py +++ b/tests/protocols/test_http.py @@ -21,7 +21,7 @@ from uvicorn.protocols.http.httptools_impl import HttpToolsProtocol skip_if_no_httptools = pytest.mark.skipif(False, reason="httptools is installed") -except ModuleNotFoundError: +except ModuleNotFoundError: # pragma: no cover skip_if_no_httptools = pytest.mark.skipif(True, reason="httptools is not installed") if TYPE_CHECKING: diff --git a/tests/protocols/test_websocket.py b/tests/protocols/test_websocket.py index 781918f40..074c01d03 100644 --- a/tests/protocols/test_websocket.py +++ b/tests/protocols/test_websocket.py @@ -30,7 +30,7 @@ from uvicorn.protocols.websockets.wsproto_impl import WSProtocol as _WSProtocol skip_if_no_wsproto = pytest.mark.skipif(False, reason="wsproto is installed.") -except ModuleNotFoundError: +except ModuleNotFoundError: # pragma: no cover skip_if_no_wsproto = pytest.mark.skipif(True, reason="wsproto is not installed.") if typing.TYPE_CHECKING: @@ -1041,11 +1041,6 @@ async def app(scope, receive, send): "headers": [(b"Content-Length", b"0"), (b"Content-Type", b"text/plain")], } await send(message) - message = { - "type": "websocket.http.response.body", - "body": b"", - } - await send(message) async def websocket_session(url): response = await wsresponse(url) @@ -1213,7 +1208,7 @@ async def app(scope: Scope, receive: ASGIReceiveCallable, send: ASGISendCallable async def websocket_session(url: str): with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info: async with websockets.client.connect(url): - pass + pass # pragma: no cover assert exc_info.value.status_code == 404 config = Config(