Skip to content

Commit

Permalink
Add missing init files in the test suite (#2432)
Browse files Browse the repository at this point in the history
* Add missing init files in the test suite

* Remove uncovered lines
  • Loading branch information
Kludex authored Aug 14, 2024
1 parent 7dc027d commit 1cb0c32
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
Empty file added tests/middleware/__init__.py
Empty file.
Empty file added tests/protocols/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/protocols/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 2 additions & 7 deletions tests/protocols/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1cb0c32

Please sign in to comment.