tests: Isolate absence-content editor cleanup assertions - #459
Merged
halfline merged 2 commits intoSep 2, 2026
Conversation
The batch storage tests verify that absence-content builders close their temporary line editors after normal completion and exceptions. The exception-path assertion replaces the close method on the editor class. Cyclic garbage collection can finalize unrelated editors while that replacement is active, so their cleanup calls can inflate the counter and fail continuous integration nondeterministically. This commit addresses that nondeterminism by retaining the exception-path builder's editor and attaching the close counter only to that instance. The final commit will apply the same isolation to the normal completion path.
The exception-path absence-content cleanup test now observes only the editor created for its builder. The normal completion test still replaces the close method on the editor class. Cyclic garbage collection can finalize unrelated editors while the completion test's replacement is active, leaving its close counter vulnerable to the same nondeterministic overcount. This commit resolves the remaining nondeterminism by retaining the completion builder's editor and attaching the close counter to that instance. The module alias used to reach the editor class becomes unnecessary and is removed. Both absence-content cleanup paths now observe only the resource they create, completing the test-isolation fix.
halfline
deleted the
publish/editor-cleanup-test-isolation-20260902T214353Z
branch
September 2, 2026 23:47
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.
Batch storage tests verify that absence-content builders close their temporary
line editors after normal completion and when construction raises an
exception.
Both assertions replace
LineEditor.closeon the class. Cyclic garbagecollection can finalize unrelated editor objects while that replacement is
active, causing their cleanup calls to increase the local counter and make the
test fail nondeterministically.
This pull request keeps a strong reference to each builder's editor and
attaches the counter only to that instance. The tests continue to exercise the
production context-manager behavior without observing cleanup from unrelated
objects.
Validation:
uv run pytest -n autouv run ruff check src tests scriptsuv run python scripts/check_translations.pyuv run python scripts/check_dead_code.pyuv run python scripts/check_type_hygiene.pyuv run mypy