Python: Add core utilities unit tests #3487
Merged
giles17 merged 6 commits intomicrosoft:mainfrom Jan 29, 2026
Merged
Conversation
Member
Contributor
There was a problem hiding this comment.
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 |
moonbox3
approved these changes
Jan 28, 2026
TaoChenOSU
approved these changes
Jan 29, 2026
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.
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