Skip to content

🤖 test: once listener removed before reentrant emit (#226) - #228

Merged
jfhbrook merged 1 commit into
jfhbrook:mainfrom
MbappeWU:test/once-reentrant-emit
Oct 31, 2026
Merged

jfhbrook merged 1 commit into
jfhbrook:mainfrom
MbappeWU:test/once-reentrant-emit

Conversation

@MbappeWU

Copy link
Copy Markdown
Contributor

Why

Fixes #226. The issue asked whether a once handler that emits the same event from inside itself belongs in the docs. @jfhbrook suggested a test, and @PerchAnton agreed and posted a candidate for tests/test_sync.py. EventEmitter.once already removes the listener before the callback; this adds that coverage and leaves the public API alone.

What changed

  • test_once_is_removed_before_reentrant_emit records the call order when a once handler emits the same event from inside itself (once → nested persistent → outer persistent), then checks a later emit only hits the persistent listener.

Scope

  • Synchronous EventEmitter only.
  • Asyncio, Trio, Twisted, and executor emitters unchanged.
  • No changelog entry: 16.0.0 is already released, and this is test-only.

Verification

  • just qa passed on this diff.
  • Pytest: 54 passed.
  • Local mutation that removed the once listener after the callback made this new test fail while older once tests still passed; that mutation is not in the commit.

AI tooling was used for this change (🤖 commit marker per DEVELOPMENT.md).

A once handler that emits the same event from inside itself must not run again.

Issue jfhbrook#226 asked for this check as a test. EventEmitter already removes the listener before the callback. This commit adds no public API change.

AI tooling wrote this change.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jfhbrook
jfhbrook merged commit 2582b8e into jfhbrook:main Oct 31, 2026
5 checks passed
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.

Docs example proposal: once listeners and reentrant emits

2 participants