From e9f70125aa27988d1d80769707f9759164ebb541 Mon Sep 17 00:00:00 2001
From: AlonMenczer <alonm@spotnix.io>
Date: Fri, 23 Jul 2021 15:02:28 +0300
Subject: [PATCH 1/2] Update starlette version
---
pyproject.toml | 2 +-
tests/test_tutorial/test_websockets/test_tutorial002.py | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 45880cc313..48e93ca7b9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
requires = [
- "starlette ==0.14.2",
+ "starlette ==0.16.0",
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0"
]
description-file = "README.md"
diff --git a/tests/test_tutorial/test_websockets/test_tutorial002.py b/tests/test_tutorial/test_websockets/test_tutorial002.py
index 7c56eb2605..27ad6cd159 100644
--- a/tests/test_tutorial/test_websockets/test_tutorial002.py
+++ b/tests/test_tutorial/test_websockets/test_tutorial002.py
@@ -72,9 +72,13 @@ def test_websocket_with_header_and_query():
def test_websocket_no_credentials():
with pytest.raises(WebSocketDisconnect):
- client.websocket_connect("/items/foo/ws")
+ with client.websocket_connect("/items/foo/ws") as websocket: # noqa: F841
+ pass
def test_websocket_invalid_data():
with pytest.raises(WebSocketDisconnect):
- client.websocket_connect("/items/foo/ws?q=bar&token=some-token")
+ with client.websocket_connect(
+ "/items/foo/ws?q=bar&token=some-token"
+ ) as websocket: # noqa: F841
+ pass
From ed70ca625774b93e342f0198f0ea353a3bde2af4 Mon Sep 17 00:00:00 2001
From: AlonMenczer <alonm@spotnix.io>
Date: Fri, 23 Jul 2021 15:13:50 +0300
Subject: [PATCH 2/2] Use same test fix from PR #3372
---
.../test_websockets/test_tutorial002.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/test_tutorial/test_websockets/test_tutorial002.py b/tests/test_tutorial/test_websockets/test_tutorial002.py
index 27ad6cd159..a8523c9c4f 100644
--- a/tests/test_tutorial/test_websockets/test_tutorial002.py
+++ b/tests/test_tutorial/test_websockets/test_tutorial002.py
@@ -72,13 +72,15 @@ def test_websocket_with_header_and_query():
def test_websocket_no_credentials():
with pytest.raises(WebSocketDisconnect):
- with client.websocket_connect("/items/foo/ws") as websocket: # noqa: F841
- pass
+ with client.websocket_connect("/items/foo/ws"):
+ pytest.fail(
+ "did not raise WebSocketDisconnect on __enter__"
+ ) # pragma: no cover
def test_websocket_invalid_data():
with pytest.raises(WebSocketDisconnect):
- with client.websocket_connect(
- "/items/foo/ws?q=bar&token=some-token"
- ) as websocket: # noqa: F841
- pass
+ with client.websocket_connect("/items/foo/ws?q=bar&token=some-token"):
+ pytest.fail(
+ "did not raise WebSocketDisconnect on __enter__"
+ ) # pragma: no cover