From d1fe7bbdf595b0dd2e71db3ba9a16ceb1e019274 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Jul 23 2021 17:21:48 +0000 Subject: Add patch to support recent starlette --- diff --git a/3594.patch b/3594.patch new file mode 100644 index 0000000..10f75e7 --- /dev/null +++ b/3594.patch @@ -0,0 +1,79 @@ +From e9f70125aa27988d1d80769707f9759164ebb541 Mon Sep 17 00:00:00 2001 +From: AlonMenczer +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 +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 diff --git a/python-fastapi.spec b/python-fastapi.spec index c852cf5..7c96a2f 100644 --- a/python-fastapi.spec +++ b/python-fastapi.spec @@ -42,6 +42,10 @@ URL: https://github.com/tiangolo/%{srcname} Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch +# PR for later starlette support +# (https://github.com/tiangolo/fastapi/pull/3594) +Patch0: https://github.com/tiangolo/fastapi/pull/3594.patch + BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros