Skip to content

Commit

Permalink
Fixed support for Quart (#2003)`
Browse files Browse the repository at this point in the history
- Changed Quart signal receivers to async functions
- Fixed test setup for Quart
  • Loading branch information
antonpirker authored Apr 12, 2023
1 parent c147d71 commit a7bcdc2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/quart.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _set_transaction_name_and_source(scope, transaction_style, request):
pass


def _request_websocket_started(app, **kwargs):
async def _request_websocket_started(app, **kwargs):
# type: (Quart, **Any) -> None
hub = Hub.current
integration = hub.get_integration(QuartIntegration)
Expand Down Expand Up @@ -205,7 +205,7 @@ def inner(event, hint):
return inner


def _capture_exception(sender, exception, **kwargs):
async def _capture_exception(sender, exception, **kwargs):
# type: (Quart, Union[ValueError, BaseException], **Any) -> None
hub = Hub.current
if hub.get_integration(QuartIntegration) is None:
Expand Down
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pytest-forked<=1.4.0
pytest-localserver==0.5.0
pytest-watch==4.2.0
tox==3.7.0
Werkzeug<2.1.0
jsonschema==3.2.0
pyrsistent==0.16.0 # TODO(py3): 0.17.0 requires python3, see https://github.com/tobgu/pyrsistent/issues/205
executing
Expand Down
20 changes: 14 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ envlist =
{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}

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

# Redis
{py2.7,py3.7,py3.8,py3.9}-redis
Expand Down Expand Up @@ -206,6 +206,7 @@ deps =
boto3-v1.16: boto3>=1.16,<1.17

# Bottle
bottle: Werkzeug<2.1.0
bottle-v0.12: bottle>=0.12,<0.13

# Celery
Expand Down Expand Up @@ -235,6 +236,7 @@ deps =
chalice: pytest-chalice==0.0.5

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

{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
Expand Down Expand Up @@ -278,6 +280,7 @@ deps =

# Flask
flask: flask-login
flask: Werkzeug<2.1.0
flask-v0.11: Flask>=0.11,<0.12
flask-v0.12: Flask>=0.12,<0.13
flask-v1.0: Flask>=1.0,<1.1
Expand Down Expand Up @@ -329,17 +332,23 @@ deps =
pymongo-v4.2: pymongo>=4.2,<4.3

# Pyramid
pyramid: Werkzeug<2.1.0
pyramid-v1.6: pyramid>=1.6,<1.7
pyramid-v1.7: pyramid>=1.7,<1.8
pyramid-v1.8: pyramid>=1.8,<1.9
pyramid-v1.9: pyramid>=1.9,<1.10
pyramid-v1.10: pyramid>=1.10,<1.11

# Quart
quart: blinker<1.6
quart: quart>=0.16.1
quart: quart-auth
quart: pytest-asyncio
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: quart>=0.17.0,<0.18.0
quart-v0.18: quart>=0.18.0,<0.19.0

# Requests
requests: requests>=2.0
Expand Down Expand Up @@ -474,7 +483,6 @@ extras =
falcon: falcon
flask: flask
pymongo: pymongo
quart: quart

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

{py2.7}: python -m pytest --ignore-glob='*py3.py' --durations=5 -vvv {env:TESTPATH} {posargs}
{py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}: python -m pytest -rsx --durations=5 -vvv {env:TESTPATH} {posargs}
{py2.7}: python -m pytest --ignore-glob='*py3.py' -rsx -s --durations=5 -vvv {env:TESTPATH} {posargs}
{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}

[testenv:linters]
commands =
Expand Down

0 comments on commit a7bcdc2

Please sign in to comment.