test: updated the testcases to the latest agent framework. Dev v4 to main#866
Open
Dhruvkumar-Microsoft wants to merge 4 commits intomainfrom
Open
test: updated the testcases to the latest agent framework. Dev v4 to main#866Dhruvkumar-Microsoft wants to merge 4 commits intomainfrom
Dhruvkumar-Microsoft wants to merge 4 commits intomainfrom
Conversation
test: updated the unit testcases to update the latest agent framework version
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the backend dependency pins and refactors the v4 backend test suite/mocks to align with breaking API changes in the agent-framework ecosystem (notably workflow.run(..., stream=True), Agent/Message, and new agent_framework_orchestrations import paths).
Changes:
- Pinned/updated backend Python dependencies and migrated agent-framework packages to rc/beta versions.
- Updated orchestration tests to reflect event dispatch via
event.typestrings and streaming viaworkflow.run(..., stream=True). - Refreshed test mocks (including
agent_framework_orchestrations) and adjusted Foundry agent tests for server-side Code Interpreter handling.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/backend/v4/orchestration/test_orchestration_manager.py | Updates orchestration mocks/tests for workflow.run(..., stream=True) and event.type dispatch. |
| src/tests/backend/v4/orchestration/test_human_approval_manager.py | Adds agent_framework_orchestrations mocks and updates agent framework symbols. |
| src/tests/backend/v4/magentic_agents/test_foundry_agent.py | Migrates tests from ChatAgent/ChatMessage to Agent/Message and removes Hosted Code Interpreter tool expectations. |
| src/tests/backend/v4/magentic_agents/common/test_lifecycle.py | Updates lifecycle tests for agent.client (replacing agent.chat_client). |
| src/tests/backend/v4/callbacks/test_response_handlers.py | Updates response handler tests to use Message for isinstance checks. |
| src/tests/backend/conftest.py | Expands global agent framework/orchestrations module stubs for import compatibility. |
| src/backend/requirements.txt | Pins and updates backend dependencies to targeted versions (including agent-framework rc/beta). |
Comments suppressed due to low confidence (1)
src/tests/backend/v4/orchestration/test_orchestration_manager.py:781
test_run_orchestration_event_processing_errorno longer exercises the intended error-handling path: the only event emitted isMockMagenticAgentDeltaEvent()which has no.type, so the production code treats it as an unknown event type and never callsstreaming_agent_response_callback(meaning the injectedside_effectis unused). Update the test to emit aneventobject withtype="output", a non-nullexecutor_id, anddatathat is anAgentResponseUpdateinstance so the streaming callback is invoked and its exception is caught/logged.
async def test_run_orchestration_event_processing_error(self):
"""Test handling of errors during event processing."""
# Set up workflow with events that cause processing errors
mock_workflow = Mock()
mock_events = [MockMagenticAgentDeltaEvent()]
mock_workflow.run = AsyncGeneratorMock(mock_events)
mock_workflow.executors = {}
# Make streaming callback raise exception
streaming_agent_response_callback.side_effect = Exception("Callback error")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
Purpose
This pull request updates the backend and test suite to support breaking changes in the
agent-frameworkecosystem, especially the move torc4versions and the removal of theHostedCodeInterpreterToolin favor of server-side code interpreter handling. It also updates dependencies to specific versions and adjusts test mocks and logic to match the new agent framework APIs.Key changes include:
Dependency and agent framework updates:
requirements.txtto pin all dependencies to specific versions, upgrade core Azure and OpenAI libraries, and switch toagent-framework-azure-ai,agent-framework-core, andagent-framework-orchestrationsrelease candidates. Added new dependencies required by the updated agent framework and removedsemantic-kernel.Test suite and mocking adjustments for agent framework v1.0.0rc4:
conftest.pyto include new classes (Agent,Message, etc.), submodules, and attributes required by the updated agent framework, and added mocks for the newagent_framework_orchestrationsmodules. [1] [2]AgentandMessageinstead ofChatAgentandChatMessage, reflecting the new agent framework API. Adjusted test assertions and patching accordingly. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]HostedCodeInterpreterTooland updated assertions to expect server-side handling, per the new framework behavior. [1] [2] [3]Other test and mock improvements:
azure.identity.aioandcommon.config.app_configto avoid import errors in tests.agent.clientinstead ofagent.chat_clientto align with new agent interface. [1] [2]These changes ensure compatibility with the latest agent framework APIs and maintain test reliability as the backend migrates to the new orchestration and agent management model.
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information