-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: Add core utilities unit tests #3487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive unit tests to improve coverage for three core utility modules (_memory.py, _serialization.py, _threads.py) in the Python agent-framework-core package, contributing to the goal of achieving 85-90% unit test coverage for the core package (issue #3356).
Changes:
- Added 4 new tests for ContextProvider base class default implementations in test_memory.py (coverage: 81% → 96%)
- Added 15 new tests for SerializationMixin edge cases including nested serialization, datetime handling, and dependency injection in test_serializable_mixin.py (coverage: 81% → 94%)
- Added 16 new tests for ChatMessageStore, AgentThread, and state classes edge cases in test_threads.py (coverage: 85% → 98%)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| python/packages/core/tests/core/test_memory.py | Added tests for ContextProvider base class default implementations (thread_created, invoked, async context manager behavior) |
| python/packages/core/tests/core/test_serializable_mixin.py | Added tests for advanced serialization scenarios including nested objects, datetime conversion, non-serializable handling, JSON deserialization, type identifiers, and dependency injection patterns |
| python/packages/core/tests/core/test_threads.py | Added tests for AgentThread initialization states, ChatMessageStore deserialization, state management edge cases, and exception handling |
| """Test to_dict skips non-serializable top-level attributes.""" | ||
| import logging | ||
|
|
||
| class NonSerializable: |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable NonSerializable is not used.
Motivation and Context
This PR adds unit tests to improve coverage for the core utility modules (
_memory.py,_serialization.py,_threads.py) as part of issue #3356 (achieving 85-90% unit test coverage for agent-framework-core).Description
Added comprehensive unit tests for:
_memory.py (81% → 96%)
_serialization.py (81% → 94%)
_threads.py (85% → 98%)
Contribution Checklist