Python: Add dedicated test coverage for agent_framework.exceptions module by LeonMinkus · Pull Request #5251 · microsoft/agent-framework
Motivation and Context
The exception hierarchy in agent_framework/exceptions.py defines 22 exception
classes across 6 categories (Agent, ChatClient, Integration, Content, Tool,
Workflow, etc.), but has no dedicated test file. This gap means inheritance
chains, logging behavior, and special attributes like
UserInputRequiredException.contents are not verified by unit tests.
Description
Adds python/packages/core/tests/core/test_exceptions.py with 129 tests
organized into 10 test classes:
- Inheritance chain tests: verify every exception is catchable by its
parent(s), up toAgentFrameworkExceptionandException - Base class behavior tests: logging at different levels,
log_level=None
suppression,inner_exceptionpropagation, extra args pass-through UserInputRequiredExceptiontests:.contentsattribute storage,
default/custom messages, no-log behavior- Instantiation smoke tests: every exception class can be created and
raised/caught
No existing code was modified. Tests only.
Contribution Checklist
- The code builds clean without any errors or warnings
- The PR follows the Contribution Guidelines
- All unit tests pass, and I have added new tests where possible
- Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.