chore: eliminate test warnings (deps upgrade + coroutine fixes)#577
Merged
chore: eliminate test warnings (deps upgrade + coroutine fixes)#577
Conversation
…recated usage - Bump pytest-asyncio >=0.25.0 and pytest-mock >=3.14.0 to fix ~1800 asyncio DeprecationWarnings on Python 3.14 - Remove deprecated `path` parameter from pytest_ignore_collect (PytestRemovedIn9Warning) - Add filterwarnings for PytestBenchmarkWarning (expected with xdist) - Migrate test_weighted_transitions.py from deprecated `current_state` to `configuration` - Convert release notes 2.3/2.4/2.5 doctests using `current_state` to plain python blocks
… coroutine warnings The error handlers _on_error_handler() and _send_error_execution() used sm.send() which triggers _processing_loop() — creating an unawaited coroutine in AsyncEngine. Since these are always called within an active macrostep, BoundEvent.put() is sufficient to enqueue the error.execution event on the internal queue without the redundant processing loop call.
…ne warnings The async invoke handler (_run_async_handler) called sm.send() without await for done.invoke and error.execution events, creating unawaited coroutines from AsyncEngine.processing_loop().
Replace machine.send() with BoundEvent.put() for error.communication events in _send_to_invoke and create_send_action_callable. These are always called within the processing loop, so put() is sufficient and avoids unawaited coroutine warnings in AsyncEngine.
When the child machine runs inside the parent's async event loop, send_to_parent returns an unawaited coroutine from AsyncEngine's processing_loop. Use asyncio.ensure_future to schedule it as a task on the running loop instead of dropping it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #577 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 33 33
Lines 4116 4121 +5
Branches 661 662 +1
=========================================
+ Hits 4116 4121 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
DummyThread instances (created by Python for foreign threads) raise AssertionError on join() in Python <3.12. Filter them out alongside asyncio threads since they are not leaked by test code.
With invoke=[task_a, task_b], each task is a separate invocation that sends its own done.invoke — the first one triggers the transition and cancels the second. Using invoke_group ensures both complete before a single done.invoke is sent.
|
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.



Summary
AsyncEngine.processing_loop():engines/base.py: useBoundEvent.put()in error handlers (_on_error_handler,_send_error_execution) — always inside processing loop, only needs enqueueinvoke.py:awaitthesend()calls in_run_async_handlerfordone.invokeanderror.executioneventsscxml/actions.py: useBoundEvent.put()forerror.communicationin_send_to_invokeandcreate_send_action_callable— always inside processing loopscxml/invoke.py: useasyncio.ensure_future()insend_to_parent— runs inside the parent's event loop but from a sync context, so schedule the coroutine as a taskpytest-benchmarkdeprecation warnings intest_weighted_transitions.pydocs/releases/)