Repository navigation
tests: keep the shared gcsfs client alive across the PID-change unit test - #725
Merged
Merged
Conversation
…test (#724) fsspec clears its instance cache on a new PID, orphaning the client the blobs integration tests used; its finalizer later closed the session on another test's loop.
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.
Closes #724
Summary
test_rebuilds_client_after_pid_changepatchesos.getpid, so fsspec clears its instance cache and drops the only strong reference to the process-wide gcsfs client. That client was already used by the blobs integration tests and holds an aiohttp session on a closed loop. When GC later frees it, gcsfs's finalizer closes the session on whatever loop is running, and an unrelated async test fails with "attached to a different loop" (onmain:test_documents_unit::test_owner_validation_success).A
keep_gcsfs_client_alivefixture on that test savesblobs._gcsfs_client, its PID, fsspec's cache and fsspec's recorded PID, and restores them on teardown, so the parent client is never orphaned. Test-only change; production never patches the PID or clears the cache.Testing
tests/db/test_blobs_unit.pyandtests/db/test_documents_unit.py: 57 passed locally.main/dev. Confirmed by the post-merge run.