aiohttp
aiohttp copied to clipboard
work around the changes in 3.11, eg asyncio.TimeoutError is an OSError, and IsolatedAsyncioTestCase calls set_event_loop differently
What do these changes do?
Fixes https://github.com/aio-libs/aiohttp/issues/6757
Are there changes in behavior for the user?
yeah, if someone overrides asyncSetUp/asyncTearDown in their tests it could cause confusion
Related issue number
Checklist
- [ ] I think the code is well written
- [ ] Unit tests for the changes exist
- [ ] Documentation reflects the changes
- [ ] If you provide code modification, please add yourself to
CONTRIBUTORS.txt- The format is <Name> <Surname>.
- Please keep alphabetical order, the file is sorted by names.
- [ ] Add a new news fragment into the
CHANGESfolder- name it
<issue_id>.<type>for example (588.bugfix) - if you don't have an
issue_idchange it to the pr id after creating the pr - ensure type is one of the following:
.feature: Signifying a new feature..bugfix: Signifying a bug fix..doc: Signifying a documentation improvement..removal: Signifying a deprecation or removal of public API..misc: A ticket has been closed, but it is not of interest to users.
- Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
- name it
might break it for 3.7, but probably possible to fix with a sys.version_info condition
Codecov Report
Merging #6877 (37b892c) into master (7bf5fa4) will decrease coverage by
71.67%. The diff coverage is7.40%.
@@ Coverage Diff @@
## master #6877 +/- ##
===========================================
- Coverage 93.44% 21.76% -71.68%
===========================================
Files 104 104
Lines 30630 30647 +17
Branches 3079 3088 +9
===========================================
- Hits 28622 6671 -21951
- Misses 1838 23864 +22026
+ Partials 170 112 -58
| Flag | Coverage Δ | |
|---|---|---|
| unit | 21.74% <7.40%> (-71.63%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| aiohttp/client.py | 24.72% <0.00%> (-0.11%) |
:arrow_down: |
| aiohttp/client_reqrep.py | 25.20% <0.00%> (-72.84%) |
:arrow_down: |
| aiohttp/connector.py | 16.86% <0.00%> (-77.08%) |
:arrow_down: |
| aiohttp/test_utils.py | 45.84% <22.22%> (-53.23%) |
:arrow_down: |
| tests/test_client_ws_functional.py | 6.41% <0.00%> (-91.83%) |
:arrow_down: |
| tests/test_client_functional.py | 8.64% <0.00%> (-89.86%) |
:arrow_down: |
| tests/test_client_ws.py | 10.81% <0.00%> (-89.19%) |
:arrow_down: |
| tests/test_web_app.py | 10.47% <0.00%> (-89.01%) |
:arrow_down: |
| tests/test_web_functional.py | 9.15% <0.00%> (-88.89%) |
:arrow_down: |
| tests/test_web_sendfile.py | 11.76% <0.00%> (-88.24%) |
:arrow_down: |
| ... and 88 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@webknjaz I think this fixes the issue with TestCase, but now there's a TimeoutError problem instead
I think I've been a bit too liberal with my except TimeoutError clauses, it's only really needed if there's a timeout contextmanager or asyncio.wait_for in the try
Note to self: After this is merged, we should remove .loop, asyncTearDown and asyncSetUp from master branch.
I think this looks fine as is, for a temporary fix to get 3.11 working. We can come back and update this with another PR once we can do the __cause__ check.
Backport to 3.8: 💔 cherry-picking failed — conflicts found
❌ Failed to cleanly apply 5bf9b4aae7046704b418c16452c2d1ced934abfb on top of patchback/backports/3.8/5bf9b4aae7046704b418c16452c2d1ced934abfb/pr-6877
Backporting merged PR #6877 into master
- Ensure you have a local repo clone of your fork. Unless you cloned it
from the upstream, this would be your
originremote. - Make sure you have an upstream repo added as a remote too. In these
instructions you'll refer to it by the name
upstream. If you don't have it, here's how you can add it:$ git remote add upstream https://github.com/aio-libs/aiohttp.git - Ensure you have the latest copy of upstream and prepare a branch
that will hold the backported code:
$ git fetch upstream $ git checkout -b patchback/backports/3.8/5bf9b4aae7046704b418c16452c2d1ced934abfb/pr-6877 upstream/3.8 - Now, cherry-pick PR #6877 contents into that branch:
If it'll yell at you with something like$ git cherry-pick -x 5bf9b4aae7046704b418c16452c2d1ced934abfbfatal: Commit 5bf9b4aae7046704b418c16452c2d1ced934abfb is a merge but no -m option was given., add-m 1as follows intead:$ git cherry-pick -m1 -x 5bf9b4aae7046704b418c16452c2d1ced934abfb - At this point, you'll probably encounter some merge conflicts. You must resolve them in to preserve the patch from PR #6877 as close to the original as possible.
- Push this branch to your fork on GitHub:
$ git push origin patchback/backports/3.8/5bf9b4aae7046704b418c16452c2d1ced934abfb/pr-6877 - Create a PR, ensure that the CI is green. If it's not — update it so that the tests and any other checks pass. This is it! Now relax and wait for the maintainers to process your pull request when they have some cycles to do reviews. Don't worry — they'll tell you if any improvements are necessary when the time comes!
🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.
Backport to 3.9: 💔 cherry-picking failed — conflicts found
❌ Failed to cleanly apply 5bf9b4aae7046704b418c16452c2d1ced934abfb on top of patchback/backports/3.9/5bf9b4aae7046704b418c16452c2d1ced934abfb/pr-6877
Backporting merged PR #6877 into master
- Ensure you have a local repo clone of your fork. Unless you cloned it
from the upstream, this would be your
originremote. - Make sure you have an upstream repo added as a remote too. In these
instructions you'll refer to it by the name
upstream. If you don't have it, here's how you can add it:$ git remote add upstream https://github.com/aio-libs/aiohttp.git - Ensure you have the latest copy of upstream and prepare a branch
that will hold the backported code:
$ git fetch upstream $ git checkout -b patchback/backports/3.9/5bf9b4aae7046704b418c16452c2d1ced934abfb/pr-6877 upstream/3.9 - Now, cherry-pick PR #6877 contents into that branch:
If it'll yell at you with something like$ git cherry-pick -x 5bf9b4aae7046704b418c16452c2d1ced934abfbfatal: Commit 5bf9b4aae7046704b418c16452c2d1ced934abfb is a merge but no -m option was given., add-m 1as follows intead:$ git cherry-pick -m1 -x 5bf9b4aae7046704b418c16452c2d1ced934abfb - At this point, you'll probably encounter some merge conflicts. You must resolve them in to preserve the patch from PR #6877 as close to the original as possible.
- Push this branch to your fork on GitHub:
$ git push origin patchback/backports/3.9/5bf9b4aae7046704b418c16452c2d1ced934abfb/pr-6877 - Create a PR, ensure that the CI is green. If it's not — update it so that the tests and any other checks pass. This is it! Now relax and wait for the maintainers to process your pull request when they have some cycles to do reviews. Don't worry — they'll tell you if any improvements are necessary when the time comes!
🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.
Backported as https://github.com/aio-libs/aiohttp/commit/fd7a29ef1a3c887a01f9e66402822e237d44d659 and https://github.com/aio-libs/aiohttp/commit/ae40e9829ccde7a501800e3453e99b6fe829bc6f.