Skip to content

Comments

chore: eliminate test warnings (deps upgrade + coroutine fixes)#577

Merged
fgmacedo merged 7 commits intodevelopfrom
chore/fix-test-warnings
Feb 21, 2026
Merged

chore: eliminate test warnings (deps upgrade + coroutine fixes)#577
fgmacedo merged 7 commits intodevelopfrom
chore/fix-test-warnings

Conversation

@fgmacedo
Copy link
Owner

Summary

  • Upgrade test dependencies (pytest-asyncio, pytest-mock, pytest-timeout, django) to eliminate ~1900 deprecation/config warnings
  • Fix all 6 unawaited coroutine warnings from AsyncEngine.processing_loop():
    • engines/base.py: use BoundEvent.put() in error handlers (_on_error_handler, _send_error_execution) — always inside processing loop, only needs enqueue
    • invoke.py: await the send() calls in _run_async_handler for done.invoke and error.execution events
    • scxml/actions.py: use BoundEvent.put() for error.communication in _send_to_invoke and create_send_action_callable — always inside processing loop
    • scxml/invoke.py: use asyncio.ensure_future() in send_to_parent — runs inside the parent's event loop but from a sync context, so schedule the coroutine as a task
  • Fix pytest-benchmark deprecation warnings in test_weighted_transitions.py
  • Fix release notes doctest formatting (docs/releases/)

…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
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8d012fe) to head (e7812d9).
⚠️ Report is 7 commits behind head on develop.

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     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@sonarqubecloud
Copy link

@fgmacedo fgmacedo merged commit 543bc71 into develop Feb 21, 2026
14 checks passed
@fgmacedo fgmacedo deleted the chore/fix-test-warnings branch February 21, 2026 11:43
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