Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix instance type of app.config #313

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/quart/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
Optional,
overload,
TypeVar,
Union,
)
from urllib.parse import quote
from weakref import WeakSet
Expand All @@ -41,6 +40,7 @@

from .asgi import ASGIHTTPConnection, ASGILifespan, ASGIWebsocketConnection
from .cli import AppGroup
from .config import Config
from .ctx import (
_AppCtxGlobals,
AppContext,
Expand Down Expand Up @@ -207,6 +207,7 @@ class Quart(App):
test_client_class: type[TestClientProtocol] # type: ignore[assignment]

aborter_class = Aborter
config_class = Config
app_ctx_globals_class = _AppCtxGlobals
asgi_http_class = ASGIHTTPConnection
asgi_lifespan_class = ASGILifespan
Expand Down Expand Up @@ -1100,7 +1101,7 @@ def ensure_async(self, func: Callable[P, T]) -> Callable[P, Awaitable[T]]:
...

def ensure_async(
self, func: Union[Callable[P, Awaitable[T]], Callable[P, T]]
self, func: Callable[P, Awaitable[T]] | Callable[P, T]
) -> Callable[P, Awaitable[T]]:
"""Ensure that the returned func is async and calls the func.

Expand Down
6 changes: 6 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from werkzeug.wrappers import Response as WerkzeugResponse

from quart.app import Quart
from quart.config import Config
from quart.globals import session, websocket
from quart.sessions import SecureCookieSession, SessionInterface
from quart.testing import no_op_push, WebsocketResponseError
Expand Down Expand Up @@ -408,3 +409,8 @@ async def index() -> str:
assert serving == [1]
assert shutdown
assert serving == [1, 2]


def test_app_config_class() -> None:
app = Quart(__name__)
assert isinstance(app.config, Config)