Python: Fix workflow tests pyright warnings#4362
Merged
TaoChenOSU merged 9 commits intomicrosoft:mainfrom Mar 3, 2026
Merged
Conversation
Member
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python workflow test suite to eliminate pyright/typing warnings and (intendedly) bring workflow tests under stricter type checking to better match the workflow system’s typing-heavy design.
Changes:
- Adjusts pyright configuration to include workflow tests and stop globally excluding
**/tests/**. - Tightens typing in workflow tests (e.g.,
AgentRunInputs,WorkflowEvent[Any], overloads forrun(stream=...)). - Adds targeted
pyright: ignore[...]/type: ignore[...]annotations where tests intentionally touch private APIs or untyped constructs.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| python/pyproject.toml | Updates pyright include/exclude settings to (intendedly) type-check workflow tests. |
| python/packages/core/tests/workflow/test_workflow_states.py | Adds explicit generic typing for filtered WorkflowEvent lists. |
| python/packages/core/tests/workflow/test_workflow_observability.py | Adds pyright ignores and stronger local variable typing for OTEL span tests. |
| python/packages/core/tests/workflow/test_workflow_kwargs.py | Adds overloads + AgentRunInputs typing for test agents; refines option dict typing. |
| python/packages/core/tests/workflow/test_workflow_context.py | Adds ignores for intentionally-invalid typing cases used in validation tests. |
| python/packages/core/tests/workflow/test_workflow_builder.py | Adds overloads and stream typing to DummyAgent; minor pyright ignores for private access. |
| python/packages/core/tests/workflow/test_workflow_agent.py | Adds overloads + missing session method typing for embedded test agents; narrows a union attr ignore. |
| python/packages/core/tests/workflow/test_workflow.py | Adds overloads and improves typing of state and filtered streamed outputs. |
| python/packages/core/tests/workflow/test_viz.py | Adds typing for fixtures/tmp_path and an import ignore for graphviz exception. |
| python/packages/core/tests/workflow/test_validation.py | Adds pyright ignores for intentionally-invalid executor classes; ignores private usage asserts. |
| python/packages/core/tests/workflow/test_typing_utils.py | Adds pyright ignores for tests that pass union-type expressions as values. |
| python/packages/core/tests/workflow/test_state.py | Adds pyright ignores for assertions against private state internals. |
| python/packages/core/tests/workflow/test_runner.py | Updates checkpointing context signatures/types and adds pyright ignores for private runner methods/fields. |
| python/packages/core/tests/workflow/test_request_info_mixin.py | Adds explicit Any annotations to satisfy strict type checking for decorator-driven tests. |
| python/packages/core/tests/workflow/test_function_executor_future.py | Adds pyright ignores for private executor internals used in assertions. |
| python/packages/core/tests/workflow/test_function_executor.py | Adds typing refinements and pyright ignores for private internals and unknown types in negative tests. |
| python/packages/core/tests/workflow/test_full_conversation.py | Adds overloads and updates context generics for agents/coordinators used in full-conversation tests. |
| python/packages/core/tests/workflow/test_executor_future.py | Adds pyright ignores and typing adjustments in future-annotation executor tests. |
| python/packages/core/tests/workflow/test_executor.py | Adds pyright ignores and formatting/typing tweaks around handler decorators and event filtering. |
| python/packages/core/tests/workflow/test_edge.py | Adds OTEL exporter typing and minor safety asserts for test helpers. |
| python/packages/core/tests/workflow/test_checkpoint_encode.py | Adds casts and pyright ignores for private constants used in encoding tests. |
| python/packages/core/tests/workflow/test_checkpoint.py | Improves typing of dataclass fields and adds targeted ignores for raw-serialization test inputs. |
| python/packages/core/tests/workflow/test_agent_utils.py | Refactors mock agent typing to match AgentRunInputs and streaming overload patterns. |
| python/packages/core/tests/workflow/test_agent_executor_tool_calls.py | Adds overloads + AgentRunInputs typing and tightens assertions on text content. |
| python/packages/core/tests/workflow/test_agent_executor.py | Adds overloads + AgentRunInputs typing, stream typing, and pyright ignores for private API usage. |
dmytrostruk
approved these changes
Mar 3, 2026
giles17
approved these changes
Mar 3, 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
Closes #777
Description
Fix warnings appear in workflow test files. Since workflow rely on typing, we are also enabling type checks for workflow tests.
Contribution Checklist