suggestion for fix for issue #2461
As described in issue #2461, the SentryWrappingMiddleware MRO is just object if Django < 3.1 (when async middleware became a thing), but the async_capable check inside the class only looks for the async_capable attribute inside the middleware class.
This PR makes that check also conditional on Django >= 3.1.
Otherwise the code calls super(.....).__init__(get_response) and for Django < 3.1 this only finds object.__init__, not the wrapped middleware __init__.
Fixes GH-2461
We have our contributing docs here, which contains some information about running our tests, but unfortunately the guide is not super detailed. If you can figure it out, I would suggest running the test suite with tox, which will allow you to run the tests with the same configuration as they are run in CI (in terms of Python version and installed dependencies). Otherwise, let me know and I will try to see if I can debug the test failures.
Also, now that the code formatting was fixed, I can see in our linting CI check that there is a typing issue. Please try to fix this as well. We use the mypy linter, which you should also be able to run locally.
@cameron-simpson It actually seems that you can ignore the failing AWS Lambda tests for now; we recently opened an issue (#2487) because these tests have been failing for all contributor PRs; it is a problem with our tests, not your PR.
Hey @cameron-simpson, we fixed the issue with our AWS Lambda tests. They currently are failing, but that is because for security reasons, I need to add a label to your PR to indicate that I have verified that your code won't leak our AWS Lambda secrets before the tests are allowed to run. Since I need to add this label every time you update the code, I will add this label once all other non-AWS Lambda checks are passing.
It looks like our CI checks and Python 3.8 common tests are failing. Please fix these, and then I will allow the AWS Lambda tests to run
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 79.71%. Comparing base (
d13fe23) to head (36cf20d). Report is 3 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #2466 +/- ##
==========================================
- Coverage 79.77% 79.71% -0.07%
==========================================
Files 133 133
Lines 14289 14290 +1
Branches 3003 3003
==========================================
- Hits 11399 11391 -8
- Misses 2067 2080 +13
+ Partials 823 819 -4
| Files | Coverage Δ | |
|---|---|---|
| sentry_sdk/integrations/django/middleware.py | 84.37% <100.00%> (+0.16%) |
:arrow_up: |
We can merge this as soon as master is green