Skip to content

fix(quart): Support quart_flask_patch #4132

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

Merged
merged 10 commits into from
Mar 13, 2025
Merged

fix(quart): Support quart_flask_patch #4132

merged 10 commits into from
Mar 13, 2025

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Mar 13, 2025

See #2709 (comment)

If quart_flask_patch is imported, it monkeypatches stuff so that the Quart app appears to be a Flask app. This confuses our Flask integration, which tries to enable itself and fails.

This PR:

  • Makes the Flask integration detect that what it sees as Flask might actually be Quart.
  • Reorganizes the Quart test suite a little to allow to test this case (a bit tricky since import quart_flask_patch needs to happen before anything else due to its monkeypatching nature).

Closes #2709

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@sentrivana sentrivana marked this pull request as ready for review March 13, 2025 14:27
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.58%. Comparing base (4c9731b) to head (a48d978).
Report is 4 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4132      +/-   ##
==========================================
+ Coverage   79.48%   79.58%   +0.09%     
==========================================
  Files         140      140              
  Lines       15624    15630       +6     
  Branches     2651     2652       +1     
==========================================
+ Hits        12419    12439      +20     
+ Misses       2372     2358      -14     
  Partials      833      833              
Files with missing lines Coverage Δ
sentry_sdk/integrations/flask.py 87.21% <100.00%> (+0.60%) ⬆️

... and 9 files with indirect coverage changes

@sentrivana sentrivana requested a review from antonpirker March 13, 2025 15:00
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@sentrivana sentrivana enabled auto-merge (squash) March 13, 2025 15:16
@sentrivana sentrivana merged commit 4f51ff3 into master Mar 13, 2025
140 checks passed
@sentrivana sentrivana deleted the ivana/quart-as-flask branch March 13, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quart_flask_patch breaks asgi
2 participants