Skip to content

test: scope atexit cleanup assertions to their client - #7469

Open
astrogilda wants to merge 1 commit into
google:mainfrom
astrogilda:codex/client-cleanup-contract-20261009
Open

astrogilda wants to merge 1 commit into
google:mainfrom
astrogilda:codex/client-cleanup-contract-20261009

Conversation

@astrogilda

Copy link
Copy Markdown

The cleanup tests count every process-wide atexit.unregister call. An older cyclic client can be collected during another client's close, producing a second call and a false failure.

Match each call to its own registered callback by identity, keep a live peer, and check repeated close with a real HTTPX transport. The spy wraps atexit.unregister, so the tests remove their real registrations.

Validation: 29 client tests pass on Python 3.11 and 3.14. Pyink, isort and compliance checks pass.

Count unregister calls for each registered callback by identity. Collect an older cyclic client inside the patched function and retain a live peer, then verify each owner separately and preserve repeated-close transport behavior.
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