Skip to content

Commit

Permalink
Wait for client on test_connection_lost_before_handshake_complete (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Jun 10, 2023
1 parent 1cb58c7 commit 3737d66
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ exclude_lines = [
"raise NotImplementedError",
]

[tool.coverage.coverage_conditional_plugin.omit]
"uvicorn/loops/uvloop.py" = "sys_platform == 'win32'"

[tool.coverage.coverage_conditional_plugin.rules]
py-win32 = "sys_platform == 'win32'"
py-not-win32 = "sys_platform != 'win32'"
Expand Down
3 changes: 2 additions & 1 deletion tests/protocols/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,13 @@ async def websocket_session(uri):
)
await asyncio.sleep(0.1)
send_accept_task.set()
await asyncio.sleep(0.1)

task.cancel()
assert response is not None
assert response.status_code == 500, response.text
assert response.text == "Internal Server Error"
assert disconnect_message == {"type": "websocket.disconnect", "code": 1006}
await task


@pytest.mark.anyio
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auto_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

try:
importlib.import_module("uvloop")
expected_loop = "uvloop"
expected_loop = "uvloop" # pragma: py-not-win32
except ImportError: # pragma: no cover
expected_loop = "asyncio"

Expand Down
2 changes: 1 addition & 1 deletion uvicorn/middleware/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,5 @@ def wsgi(self, environ: Environ, start_response: StartResponse) -> None:

try:
from a2wsgi import WSGIMiddleware
except ModuleNotFoundError:
except ModuleNotFoundError: # pragma: no cover
WSGIMiddleware = _WSGIMiddleware # type: ignore[misc, assignment]

0 comments on commit 3737d66

Please sign in to comment.