mindflayer / python-mocket

a socket mock framework - for all kinds of socket animals, web-clients included
BSD 3-Clause "New" or "Revised" License
280 stars 42 forks source link

Support for Python 3.11 #181

Closed mindflayer closed 1 year ago

mindflayer commented 2 years ago
sonarcloud[bot] commented 2 years ago

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 commented 1 year ago

Hi there,

aiming to add support for Python 3.11 to the Terkin Datalogger, we had to downgrade to mocket<3.9 (see https://github.com/hiveeyes/terkin-datalogger/commit/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 https://github.com/benoitc/http-parser/pull/95.

With kind regards, Andreas.

mindflayer commented 1 year ago

Hi Andreas, I'm aware of it and keeping an eye on their repo. There is already an issue with the fix but it hasn't been merged yet. I was planning to write to the author in case it won't be taken care of soon.

Regards, Giorgio

On Sat, 26 Nov 2022, 18:26 Andreas Motl, @.***> wrote:

Hi there,

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

It looks like http-parser is not ready for Python 3.11 yet.

With kind regards, Andreas.

— Reply to this email directly, view it on GitHub https://github.com/mindflayer/python-mocket/pull/181#issuecomment-1328093094, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAXXILSDXTEFOPVER5FRTWKJI4RANCNFSM5WSLLATQ . You are receiving this because you authored the thread.Message ID: @.***>

amotl commented 1 year ago

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

amotl commented 1 year ago

Hi again,

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

With https://github.com/hiveeyes/terkin-datalogger/commit/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 commented 1 year ago

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.

amotl commented 1 year ago

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.

sonarcloud[bot] commented 1 year ago

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