Skip to content

Commit a7bcdc2

Browse files
authored
Fixed support for Quart (#2003)`
- Changed Quart signal receivers to async functions - Fixed test setup for Quart
1 parent c147d71 commit a7bcdc2

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

sentry_sdk/integrations/quart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def _set_transaction_name_and_source(scope, transaction_style, request):
151151
pass
152152

153153

154-
def _request_websocket_started(app, **kwargs):
154+
async def _request_websocket_started(app, **kwargs):
155155
# type: (Quart, **Any) -> None
156156
hub = Hub.current
157157
integration = hub.get_integration(QuartIntegration)
@@ -205,7 +205,7 @@ def inner(event, hint):
205205
return inner
206206

207207

208-
def _capture_exception(sender, exception, **kwargs):
208+
async def _capture_exception(sender, exception, **kwargs):
209209
# type: (Quart, Union[ValueError, BaseException], **Any) -> None
210210
hub = Hub.current
211211
if hub.get_integration(QuartIntegration) is None:

test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pytest-forked<=1.4.0
66
pytest-localserver==0.5.0
77
pytest-watch==4.2.0
88
tox==3.7.0
9-
Werkzeug<2.1.0
109
jsonschema==3.2.0
1110
pyrsistent==0.16.0 # TODO(py3): 0.17.0 requires python3, see https://github.com/tobgu/pyrsistent/issues/205
1211
executing

tox.ini

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ envlist =
114114
{py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-pyramid-v{1.6,1.7,1.8,1.9,1.10}
115115

116116
# Quart
117-
{py3.7,py3.8,py3.9,py3.10,py3.11}-quart
117+
{py3.7,py3.8,py3.9,py3.10,py3.11}-quart-v{0.16,0.17,0.18}
118118

119119
# Redis
120120
{py2.7,py3.7,py3.8,py3.9}-redis
@@ -206,6 +206,7 @@ deps =
206206
boto3-v1.16: boto3>=1.16,<1.17
207207

208208
# Bottle
209+
bottle: Werkzeug<2.1.0
209210
bottle-v0.12: bottle>=0.12,<0.13
210211

211212
# Celery
@@ -235,6 +236,7 @@ deps =
235236
chalice: pytest-chalice==0.0.5
236237

237238
# Django
239+
django: Werkzeug<2.1.0
238240
django-v{1.11,2.0,2.1,2.2,3.0,3.1,3.2}: djangorestframework>=3.0.0,<4.0.0
239241

240242
{py3.7,py3.8,py3.9,py3.10,py3.11}-django-v{1.11,2.0,2.1,2.2,3.0,3.1,3.2}: channels[daphne]>2
@@ -278,6 +280,7 @@ deps =
278280

279281
# Flask
280282
flask: flask-login
283+
flask: Werkzeug<2.1.0
281284
flask-v0.11: Flask>=0.11,<0.12
282285
flask-v0.12: Flask>=0.12,<0.13
283286
flask-v1.0: Flask>=1.0,<1.1
@@ -329,17 +332,23 @@ deps =
329332
pymongo-v4.2: pymongo>=4.2,<4.3
330333

331334
# Pyramid
335+
pyramid: Werkzeug<2.1.0
332336
pyramid-v1.6: pyramid>=1.6,<1.7
333337
pyramid-v1.7: pyramid>=1.7,<1.8
334338
pyramid-v1.8: pyramid>=1.8,<1.9
335339
pyramid-v1.9: pyramid>=1.9,<1.10
336340
pyramid-v1.10: pyramid>=1.10,<1.11
337341

338342
# Quart
339-
quart: blinker<1.6
340-
quart: quart>=0.16.1
341343
quart: quart-auth
342344
quart: pytest-asyncio
345+
quart-v0.16: blinker<1.6
346+
quart-v0.16: jinja2<3.1.0
347+
quart-v0.16: Werkzeug<2.1.0
348+
quart-v0.17: blinker<1.6
349+
quart-v0.16: quart>=0.16.1,<0.17.0
350+
quart-v0.17: quart>=0.17.0,<0.18.0
351+
quart-v0.18: quart>=0.18.0,<0.19.0
343352

344353
# Requests
345354
requests: requests>=2.0
@@ -474,7 +483,6 @@ extras =
474483
falcon: falcon
475484
flask: flask
476485
pymongo: pymongo
477-
quart: quart
478486

479487
basepython =
480488
py2.7: python2.7
@@ -510,8 +518,8 @@ commands =
510518
; when loading tests in scenarios. In particular, django fails to
511519
; load the settings from the test module.
512520

513-
{py2.7}: python -m pytest --ignore-glob='*py3.py' --durations=5 -vvv {env:TESTPATH} {posargs}
514-
{py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}: python -m pytest -rsx --durations=5 -vvv {env:TESTPATH} {posargs}
521+
{py2.7}: python -m pytest --ignore-glob='*py3.py' -rsx -s --durations=5 -vvv {env:TESTPATH} {posargs}
522+
{py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}: python -m pytest -rsx -s --durations=5 -vvv {env:TESTPATH} {posargs}
515523

516524
[testenv:linters]
517525
commands =

0 commit comments

Comments
 (0)