Skip to content

Python: Add dedicated test coverage for agent_framework.exceptions module#5251

Open
LeonMinkus wants to merge 1 commit intomicrosoft:mainfrom
LeonMinkus:add-exception-tests
Open

Python: Add dedicated test coverage for agent_framework.exceptions module#5251
LeonMinkus wants to merge 1 commit intomicrosoft:mainfrom
LeonMinkus:add-exception-tests

Conversation

@LeonMinkus
Copy link
Copy Markdown

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 to AgentFrameworkException and Exception
  • Base class behavior tests: logging at different levels, log_level=None
    suppression, inner_exception propagation, extra args pass-through
  • UserInputRequiredException tests: .contents attribute 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.

@LeonMinkus
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@github-actions github-actions bot changed the title Add dedicated test coverage for agent_framework.exceptions module Python: Add dedicated test coverage for agent_framework.exceptions module Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants