Fix read forever loop - #15
Open
iivanov-qb wants to merge 8 commits into
Open
Conversation
iivanov-qb
commented
Aug 27, 2026
Contributor
- Fix read_forever loop
- Migrate to uv
- Add github action to run the tests
- Fix handle_authentication interface mismatch
- Fix get_event_loop on newer python versions
- Drop deprecated ZMQEventLoop usage
- Various minor test fixes
- Cleanup socket leftovers after tests
The task is the only consumer of the socket and any non-handled exception would kill the task and cut off every peer. Catch all exceptions and let all BaseException subclasses escape: Those are CancelledError, SystemExit, etc.
Replace msgpack-python with msgpack. We now rely on msgpack>=1 as we don't provide the encoding argument anymore. Add github action to run the tests as well.
The interface wrongly declared self as an explicit parameter, unlike every sibling method, which made zope.interface.verifyClass reject even backends that implemented it correctly. Also add the missing no-op implementation to the trivial backends that don't need the two-step auth challenge flow.
asyncio.get_event_loop() now raises instead of auto-creating a loop when none is running or set, breaking any caller that builds a Client/Server without passing loop= explicitly. Catch that and fall back to creating and setting a new loop, matching the old behavior.
zmq.asyncio.install() and a custom ZMQEventLoop fixture are no longer needed: pyzmq 17+ sockets work with any standard asyncio loop. Keeping them also broke tests, since pytest-asyncio stopped honoring a same-named event_loop fixture override, so async tests ran on a different loop than the one handed to Client/Server. Replace the shared loop fixture with one that returns the loop pytest-asyncio is actually driving, and give test_sync_client.py its own sync fixture, since those tests aren't async.
- test_basic_heartbeating: widen the sleep window from 1.1s to 2s. ~0.5s of unavoidable PLAIN auth + PUB/SUB slow-joiner startup latency was eating into the original window, leaving too little steady-state time for 10 heartbeats at .1s apart to land. - test_packer_translation: update a hardcoded packed-bytes literal. Current msgpack picks the more compact fixext4 form for this 4-byte ext payload instead of the general ext8 form; same value, round-trips fine, the test just asserted stale exact bytes. Not a client/server compatibility issue: verified old msgpack-python and current msgpack decode each other's output byte-for-byte. - test_job_server_never_reply: fix a str/bytes mismatch left over from very old code. The zmq delimiter frame is always bytes, and Packer.unpackb decodes str fields back to str, not bytes.
ipc:// endpoints bind a real unix socket file on disk, and closing the socket doesn't unlink it. Several tests bind relative, bare names (e.g. 'ipc://here'), which land in the cwd pytest runs from and were piling up uncommitted in the repo root. Add an autouse fixture that snapshots the cwd before each test and removes any newly created socket files after it.
Includes: * Fix read_forever loop * Migrate to uv * Add github action to run the tests * Fix handle_authentication interface mismatch * Fix get_event_loop on newer python versions * Drop deprecated ZMQEventLoop usage * Various minor test fixes * Cleanup socket leftovers after tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.