Skip to content

test: count paused slot fallbacks without waking lazy objects from other tests - #418

Closed
JuroOravec wants to merge 1 commit into
mainfrom
fix/snapshot-gc-scan
Closed

JuroOravec wants to merge 1 commit into
mainfrom
fix/snapshot-gc-scan

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Fourteen test_render_body_snapshots.py cases fail when the citry, citry_ui and citry_lsp suites run together under -n 4, and pass when run alone. Nothing in Citry's state leaks between packages. The cause is the test's own helper.

  • _paused_fallbacks() walks gc.get_objects() and calls isinstance(value, types.GeneratorType) on every live object.
  • isinstance() also reads __class__. Django's staticfiles_storage is a lazy proxy that another package's tests left alive, and it answers that read by setting itself up. Without static files settings, the setup raises ImproperlyConfigured:
django/contrib/staticfiles/storage.py:548: in _setup
...
django.core.exceptions.ImproperlyConfigured: ...

The helper now compares type(value) is types.GeneratorType, which reads the real type and leaves proxies alone.

I checked for the same pattern elsewhere. The only other gc.get_objects() scan in the repo, in test_native_render_rows.py, already uses type(). No library code walks gc objects.

Evidence: citry, citry_ui and citry_lsp together (-m "not e2e" -n 4) now pass all 121 snapshot cases. The 4 remaining failures are unrelated:

🤖 Generated with Claude Code

…her tests

Fourteen test_render_body_snapshots cases failed when the citry, citry_ui
and citry_lsp test suites ran together under -n 4, and passed alone.
Their helper counts paused slot fallbacks by walking gc.get_objects()
with isinstance(). isinstance() also reads __class__, and a lazy proxy
that another package's tests left alive, Django's staticfiles_storage,
answers that by setting itself up, which raises ImproperlyConfigured
without static files settings.

The helper now compares type(), which reads the real type and leaves
proxies alone. The only other gc.get_objects() scan, in
test_native_render_rows.py, already uses type().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec

Copy link
Copy Markdown
Member Author

Closing as a duplicate of #409, which makes the same one-line change to _paused_fallbacks(). Any sweep findings for the same pattern in other tests will go to #409.

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.

1 participant