Skip to content

Python: Fix workflow tests pyright warnings#4362

Merged
TaoChenOSU merged 9 commits intomicrosoft:mainfrom
TaoChenOSU:taochen/python-fix-workflow-test-pyright-warnings
Mar 3, 2026
Merged

Python: Fix workflow tests pyright warnings#4362
TaoChenOSU merged 9 commits intomicrosoft:mainfrom
TaoChenOSU:taochen/python-fix-workflow-test-pyright-warnings

Conversation

@TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Feb 28, 2026

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

  • 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.

@TaoChenOSU TaoChenOSU self-assigned this Feb 28, 2026
@TaoChenOSU TaoChenOSU added the workflows Related to Workflows in agent-framework label Feb 28, 2026
@github-actions github-actions bot changed the title Fix workflow tests pyright warnings Python: Fix workflow tests pyright warnings Feb 28, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 28, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL22222275987% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
4717 247 💤 0 ❌ 0 🔥 1m 18s ⏱️

@TaoChenOSU TaoChenOSU marked this pull request as ready for review March 2, 2026 22:46
Copilot AI review requested due to automatic review settings March 2, 2026 22:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for run(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.

@TaoChenOSU TaoChenOSU added this pull request to the merge queue Mar 3, 2026
Merged via the queue into microsoft:main with commit 1a8729d Mar 3, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Python: fix pylance / pyright / typing warnings in workflow unit tests

5 participants