diff --git a/sentry_sdk/integrations/quart.py b/sentry_sdk/integrations/quart.py index ea874ed37c..38420ec795 100644 --- a/sentry_sdk/integrations/quart.py +++ b/sentry_sdk/integrations/quart.py @@ -38,7 +38,6 @@ request, websocket, ) - from quart.scaffold import Scaffold # type: ignore from quart.signals import ( # type: ignore got_background_exception, got_request_exception, @@ -49,6 +48,12 @@ from quart.utils import is_coroutine_function # type: ignore except ImportError: raise DidNotEnable("Quart is not installed") +else: + # Quart 0.19 is based on Flask and hence no longer has a Scaffold + try: + from quart.scaffold import Scaffold # type: ignore + except ImportError: + from flask.sansio.scaffold import Scaffold # type: ignore TRANSACTION_STYLE_VALUES = ("endpoint", "url") diff --git a/tests/integrations/quart/test_quart.py b/tests/integrations/quart/test_quart.py index 93c46f5903..0f693088c9 100644 --- a/tests/integrations/quart/test_quart.py +++ b/tests/integrations/quart/test_quart.py @@ -32,8 +32,8 @@ @pytest_asyncio.fixture async def app(): app = Quart(__name__) - app.debug = True - app.config["TESTING"] = True + app.debug = False + app.config["TESTING"] = False app.secret_key = "haha" auth_manager.init_app(app) @@ -123,22 +123,15 @@ async def test_transaction_style( @pytest.mark.asyncio -@pytest.mark.parametrize("debug", (True, False)) -@pytest.mark.parametrize("testing", (True, False)) async def test_errors( sentry_init, capture_exceptions, capture_events, app, - debug, - testing, integration_enabled_params, ): sentry_init(debug=True, **integration_enabled_params) - app.debug = debug - app.testing = testing - @app.route("/") async def index(): 1 / 0 @@ -323,9 +316,6 @@ def foo(): async def test_500(sentry_init, capture_events, app): sentry_init(integrations=[quart_sentry.QuartIntegration()]) - app.debug = False - app.testing = False - @app.route("/") async def index(): 1 / 0 @@ -349,9 +339,6 @@ async def error_handler(err): async def test_error_in_errorhandler(sentry_init, capture_events, app): sentry_init(integrations=[quart_sentry.QuartIntegration()]) - app.debug = False - app.testing = False - @app.route("/") async def index(): raise ValueError() diff --git a/tox.ini b/tox.ini index 952823bc41..2f082b8d58 100644 --- a/tox.ini +++ b/tox.ini @@ -134,6 +134,7 @@ envlist = # Quart {py3.7,py3.8,py3.9,py3.10,py3.11}-quart-v{0.16,0.17,0.18} + {py3.8,py3.9,py3.10,py3.11}-quart-v{0.19} # Redis {py2.7,py3.7,py3.8,py3.9,py3.10,py3.11}-redis @@ -403,14 +404,17 @@ deps = # Quart quart: quart-auth quart: pytest-asyncio - quart: werkzeug<3.0.0 quart-v0.16: blinker<1.6 quart-v0.16: jinja2<3.1.0 quart-v0.16: Werkzeug<2.1.0 - quart-v0.17: blinker<1.6 quart-v0.16: quart>=0.16.1,<0.17.0 + quart-v0.17: Werkzeug<3.0.0 + quart-v0.17: blinker<1.6 quart-v0.17: quart>=0.17.0,<0.18.0 + quart-v0.18: Werkzeug<3.0.0 quart-v0.18: quart>=0.18.0,<0.19.0 + quart-v0.19: Werkzeug>=3.0.0 + quart-v0.19: quart>=0.19.0,<0.20.0 # Requests requests: requests>=2.0