]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬆ Upgrade version required of Starlette from `0.19.1` to `0.20.4` (#4820)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Thu, 15 Sep 2022 12:32:05 +0000 (14:32 +0200)
committerGitHub <noreply@github.com>
Thu, 15 Sep 2022 12:32:05 +0000 (14:32 +0200)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
fastapi/applications.py
fastapi/security/api_key.py
pyproject.toml
tests/test_tutorial/test_sql_databases_peewee/test_sql_databases_peewee.py
tests/test_union_inherited_body.py
tests/utils.py

index a242c504c15dbe9e6fde035fcf5d08d9aa0f84a0..61d4582d270209c6faf0ea5f9231f49cd6f513e8 100644 (file)
@@ -33,9 +33,10 @@ from fastapi.types import DecoratedCallable
 from fastapi.utils import generate_unique_id
 from starlette.applications import Starlette
 from starlette.datastructures import State
-from starlette.exceptions import ExceptionMiddleware, HTTPException
+from starlette.exceptions import HTTPException
 from starlette.middleware import Middleware
 from starlette.middleware.errors import ServerErrorMiddleware
+from starlette.middleware.exceptions import ExceptionMiddleware
 from starlette.requests import Request
 from starlette.responses import HTMLResponse, JSONResponse, Response
 from starlette.routing import BaseRoute
index 36ab60e30f45a55334dec450c0c447dca1c18d42..bca5c721a69967ccb257f2a13c5cb5ca8c8bd245 100644 (file)
@@ -27,7 +27,7 @@ class APIKeyQuery(APIKeyBase):
         self.auto_error = auto_error
 
     async def __call__(self, request: Request) -> Optional[str]:
-        api_key: str = request.query_params.get(self.model.name)
+        api_key = request.query_params.get(self.model.name)
         if not api_key:
             if self.auto_error:
                 raise HTTPException(
index f5c9efd2aac06c6314e6b2586d75e35866602791..6400a942b3084b70d628c1bfa8b3c3c0c6e169bc 100644 (file)
@@ -38,7 +38,7 @@ classifiers = [
     "Topic :: Internet :: WWW/HTTP",
 ]
 dependencies = [
-    "starlette==0.19.1",
+    "starlette==0.20.4",
     "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
 ]
 dynamic = ["version"]
index d28ea5e7670d3b7ccafa8263b74de3643874a766..1b4a7b302c39c963f893323b852babe5b6c2cf4a 100644 (file)
@@ -5,8 +5,6 @@ from unittest.mock import MagicMock
 import pytest
 from fastapi.testclient import TestClient
 
-from ...utils import needs_py37
-
 openapi_schema = {
     "openapi": "3.0.2",
     "info": {"title": "FastAPI", "version": "0.1.0"},
@@ -340,14 +338,12 @@ def client():
     test_db.unlink()
 
 
-@needs_py37
 def test_openapi_schema(client):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
     assert response.json() == openapi_schema
 
 
-@needs_py37
 def test_create_user(client):
     test_user = {"email": "johndoe@example.com", "password": "secret"}
     response = client.post("/users/", json=test_user)
@@ -359,7 +355,6 @@ def test_create_user(client):
     assert response.status_code == 400, response.text
 
 
-@needs_py37
 def test_get_user(client):
     response = client.get("/users/1")
     assert response.status_code == 200, response.text
@@ -368,13 +363,11 @@ def test_get_user(client):
     assert "id" in data
 
 
-@needs_py37
 def test_inexistent_user(client):
     response = client.get("/users/999")
     assert response.status_code == 404, response.text
 
 
-@needs_py37
 def test_get_users(client):
     response = client.get("/users/")
     assert response.status_code == 200, response.text
@@ -386,7 +379,6 @@ def test_get_users(client):
 time.sleep = MagicMock()
 
 
-@needs_py37
 def test_get_slowusers(client):
     response = client.get("/slowusers/")
     assert response.status_code == 200, response.text
@@ -395,7 +387,6 @@ def test_get_slowusers(client):
     assert "id" in data[0]
 
 
-@needs_py37
 def test_create_item(client):
     item = {"title": "Foo", "description": "Something that fights"}
     response = client.post("/users/1/items/", json=item)
@@ -419,7 +410,6 @@ def test_create_item(client):
     assert item_to_check["description"] == item["description"]
 
 
-@needs_py37
 def test_read_items(client):
     response = client.get("/items/")
     assert response.status_code == 200, response.text
index 60b327ebcc0370d69288611c953951f164e1e83d..9ee981b24e9b99fc4ad8590508443b3fb7c68d5f 100644 (file)
@@ -4,14 +4,6 @@ from fastapi import FastAPI
 from fastapi.testclient import TestClient
 from pydantic import BaseModel
 
-from .utils import needs_py37
-
-# In Python 3.6:
-# u = Union[ExtendedItem, Item] == __main__.Item
-
-# But in Python 3.7:
-# u = Union[ExtendedItem, Item] == typing.Union[__main__.ExtendedItem, __main__.Item]
-
 app = FastAPI()
 
 
@@ -118,21 +110,18 @@ inherited_item_openapi_schema = {
 }
 
 
-@needs_py37
 def test_inherited_item_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
     assert response.json() == inherited_item_openapi_schema
 
 
-@needs_py37
 def test_post_extended_item():
     response = client.post("/items/", json={"name": "Foo", "age": 5})
     assert response.status_code == 200, response.text
     assert response.json() == {"item": {"name": "Foo", "age": 5}}
 
 
-@needs_py37
 def test_post_item():
     response = client.post("/items/", json={"name": "Foo"})
     assert response.status_code == 200, response.text
index 777bfe81daff7d6c994f633e89276160cd2ce5fd..5305424c4563b223be59d715b47ad4176976dd55 100644 (file)
@@ -2,7 +2,6 @@ import sys
 
 import pytest
 
-needs_py37 = pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7+")
 needs_py39 = pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9+")
 needs_py310 = pytest.mark.skipif(
     sys.version_info < (3, 10), reason="requires python3.10+"