Skip to content

test: add comprehensive tests for task/ module#75

Open
koriyoshi2041 wants to merge 4 commits intoagentclientprotocol:mainfrom
koriyoshi2041:test/add-task-module-tests
Open

test: add comprehensive tests for task/ module#75
koriyoshi2041 wants to merge 4 commits intoagentclientprotocol:mainfrom
koriyoshi2041:test/add-task-module-tests

Conversation

@koriyoshi2041
Copy link

Summary

  • Add 28 tests across 4 new test files covering the previously-untested task/ module
  • Tests cover TaskSupervisor, InMemoryMessageStateStore, InMemoryMessageQueue, and DefaultMessageDispatcher
  • Achieves ~85% line coverage for the task/ module (up from 0%)

Files Added

File Tests Module Covered
test_task_supervisor.py 8 Lifecycle, error handling, shutdown, cancellation
test_task_state.py 9 Outgoing future resolution/rejection, incoming records
test_task_queue.py 6 Publish/consume FIFO, close semantics, join
test_task_dispatcher.py 5 Request/notification routing, error propagation

Test plan

  • All 28 tests pass locally (pytest -v)
  • ruff check passes (zero violations)
  • ruff format --check passes
  • No RuntimeWarning about unawaited coroutines
  • Tests are independent of existing test infrastructure (conftest.py imports)
  • Tests use only public APIs — no monkeypatching or private attribute access beyond store._incoming for state verification

🤖 Generated with Claude Code

koriyoshi2041 and others added 4 commits March 6, 2026 12:56
Cover the 4 previously-untested task/ submodules:
- supervisor.py: lifecycle, error handling, shutdown, cancellation (8 tests)
- state.py: outgoing future resolution/rejection, incoming records (9 tests)
- queue.py: publish/consume FIFO, close semantics, join (6 tests)
- dispatcher.py: request/notification routing, error propagation (5 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Properly close the asyncio.sleep(0) coroutine that is never
scheduled when supervisor.create() raises after shutdown.
Eliminates RuntimeWarning about unawaited coroutine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prefix the pytest.raises match pattern with r"..." to satisfy
ruff RUF043 (regex metacharacters in non-raw string).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert supervisor and queue fixtures to pytest_asyncio fixtures
that guarantee cleanup even when assertions fail mid-test.
Add comment documenting private attribute access in dispatcher test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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