Python: Achieve 85%+ unit test coverage for azurefunctions package#3866
Merged
TaoChenOSU merged 10 commits intomainfrom Feb 13, 2026
Merged
Python: Achieve 85%+ unit test coverage for azurefunctions package#3866TaoChenOSU merged 10 commits intomainfrom
TaoChenOSU merged 10 commits intomainfrom
Conversation
Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
…ns package Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
…ckage Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Track unit test coverage for azurefunctions package
Python: Achieve 85%+ unit test coverage for azurefunctions package
Feb 11, 2026
Contributor
|
@copilot can you fix the failing checks |
Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
Contributor
Author
Fixed the linting errors in commit fc4844f. The issue was nested
|
larohra
reviewed
Feb 11, 2026
Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
Contributor
Author
Member
larohra
approved these changes
Feb 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases unit test coverage for the agent-framework-azurefunctions Python package to meet/exceed the 85% GA requirement by adding targeted tests for previously uncovered paths in orchestration, entities, request parsing, and custom errors.
Changes:
- Added new unit tests for orchestration helpers (
AgentTask.try_set_value) and executor ID generation. - Added a new test module for
_errors.py(IncomingRequestError) and expanded tests around entity execution edge cases. - Expanded
AgentFunctionApptests to cover request parsing/coercion helpers and various error/validation paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| python/packages/azurefunctions/tests/test_orchestration.py | Adds coverage for AgentTask exception handling and AzureFunctionsAgentExecutor.generate_unique_id. |
| python/packages/azurefunctions/tests/test_errors.py | New tests covering IncomingRequestError behavior and status code handling. |
| python/packages/azurefunctions/tests/test_entities.py | Adds tests for non-dict inputs and event loop edge cases in durable entity execution. |
| python/packages/azurefunctions/tests/test_app.py | Adds tests for AgentFunctionApp helper methods (parsing, coercion, session/thread id handling) and init validation. |
… from docstrings, improve test clarity Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
TaoChenOSU
approved these changes
Feb 13, 2026
giles17
approved these changes
Feb 13, 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
The azurefunctions GA package required 85% unit test coverage. Initial state: 80% coverage with significant gaps in error handling, edge cases, and utility methods.
Description
Increased coverage from 80% to 86% through surgical test additions targeting uncovered code paths.
Coverage by module:
_errors.py: 50% → 100% (4 tests added)_entities.py: 86% → 100% (5 tests added)_orchestration.py: 93% → 100% (2 tests added)_app.py: 77% → 81% (10 tests added)Test additions:
test_errors.py: New file for exception initialization and custom status codestest_entities.py: Input validation, event loop handling, async edge casestest_orchestration.py: Exception handling during response conversion, UUID generationtest_app.py: Parameter validation, utility methods, boolean coercion, JSON parsingCode quality improvements:
withstatements in test filesAll tests follow existing patterns. No breaking changes. Test suite: 80 → 101 tests.
Contribution Checklist
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.