Skip to content
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

Support for Python 3.11 #181

Merged
merged 25 commits into from
Feb 19, 2023
Merged

Support for Python 3.11 #181

merged 25 commits into from
Feb 19, 2023

Conversation

mindflayer
Copy link
Owner

@mindflayer mindflayer commented May 21, 2022

  • Migrating the HTTP[S] mock from relying on http-parser to httptools.
  • Never discovered the root cause for the failing tests with aiohttp/Python 3.11 (first time ever I added @pytest.mark.xfail to a test). Same test works with httpx, so I suspect it's related to a client issue. I'll probably migrate to httpx as the one for testing async/await code.

@sonarcloud
Copy link

sonarcloud bot commented Jul 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@amotl
Copy link
Contributor

amotl commented Nov 26, 2022

Hi there,

aiming to add support for Python 3.11 to the Terkin Datalogger, we had to downgrade to mocket<3.9 (see hiveeyes/terkin-datalogger@3b8a94bb0), in order to make it work on Python 3.11.

It looks like http-parser is not ready for Python 3.11 yet, see benoitc/http-parser#95.

With kind regards,
Andreas.

@mindflayer
Copy link
Owner Author

mindflayer commented Nov 26, 2022 via email

@amotl
Copy link
Contributor

amotl commented Nov 26, 2022

Thank you! I've added a comment to benoitc/http-parser#95, and exercised the upgrade to Python 3.11 and mocket-3.9.x on behalf of hiveeyes/terkin-datalogger#116 1.

Footnotes

  1. https://github.com/hiveeyes/terkin-datalogger/actions/runs/3555613712/jobs/5972413084

LarsMichelsen pushed a commit to Checkmk/checkmk that referenced this pull request Nov 30, 2022
- this is a preparation step torwards 3.11
- anyway, unit tests without mocking are even better :-)

Background:
- mocket depends on ancient http-parser where we don't know if it is getting 3.11 soonish...
- See:
benoitc/http-parser@9099eac
mindflayer/python-mocket#181

CMK-11556

Change-Id: I41c081f8aabd4833d647888c2b7d3d8aa3d15df4
@amotl
Copy link
Contributor

amotl commented Dec 3, 2022

Hi again,

[...] we had to downgrade to mocket<3.9 (see hiveeyes/terkin-datalogger@3b8a94bb0), in order to make it work on Python 3.11.

With hiveeyes/terkin-datalogger@ffcffbaa26, the test suite now uses a modern version of Mocket for all Python versions <3.11, while still resorting to mocket<3.9 on Python 3.11.

We know it is not an optimal solution, and this release probably lacks many features, but it was enough to satisfy our test suite, and it might help others as well.

With kind regards,
Andreas.

@mindflayer
Copy link
Owner Author

mindflayer commented Dec 12, 2022

Hi @amotl, I replaced http-parser with the modern httptools, but some tests are failing on Python 3.11 - nothing to do with the parser, though.
I'll do my best to try to tackle those issues and close this PR as soon as possible. Feel free to have a look at them, in case you have some time for it.

oschwald added a commit to maxmind/minfraud-api-python that referenced this pull request Dec 13, 2022
mocket currently does not work with 3.11. See these issues:

mindflayer/python-mocket#181
benoitc/http-parser#95
oschwald added a commit to maxmind/GeoIP2-python that referenced this pull request Dec 13, 2022
mocket currently does not work with 3.11. See these issues:

mindflayer/python-mocket#181
benoitc/http-parser#95
oschwald added a commit to maxmind/minfraud-api-python that referenced this pull request Dec 13, 2022
mocket currently does not work with 3.11. See these issues:

mindflayer/python-mocket#181
benoitc/http-parser#95
@amotl
Copy link
Contributor

amotl commented Dec 16, 2022

Hi @mindflayer,

thanks for sharing those news. I had a look at the exception message aiohttp.client_exceptions.ClientOSError: Cannot write to closing transport, but the code at this place is not trivial, so I could not figure it out.

Maybe those discussions have some hints about that exception?

With kind regards,
Andreas.

@mindflayer mindflayer changed the title Testing Python 3.11 Support for Python 3.11 Dec 17, 2022
@mindflayer mindflayer force-pushed the chore/testing-py-3-11 branch 8 times, most recently from 6e42f24 to c87c222 Compare December 17, 2022 23:05
@mindflayer mindflayer force-pushed the chore/testing-py-3-11 branch 3 times, most recently from d32c7c0 to dee5f0b Compare December 28, 2022 15:33
@sonarcloud
Copy link

sonarcloud bot commented Feb 19, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
3.6% 3.6% Duplication

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.

2 participants