ci: lint test import hygiene with Ruff#1022
Open
liujuanjuan1984 wants to merge 2 commits intoa2aproject:mainfrom
Open
ci: lint test import hygiene with Ruff#1022liujuanjuan1984 wants to merge 2 commits intoa2aproject:mainfrom
liujuanjuan1984 wants to merge 2 commits intoa2aproject:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a ruff-tests.toml configuration file and performs a comprehensive cleanup of import statements across the test suite. The changes involve reordering imports, removing unused dependencies, and standardizing import groupings to improve code consistency and maintainability. I have no feedback to provide as there are no review comments to assess.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/events/event_queue_v2.py | 91.71% | 91.19% | 🔴 -0.52% |
| src/a2a/utils/telemetry.py | 91.41% | 90.63% | 🔴 -0.78% |
| Total | 93.03% | 93.00% | 🔴 -0.02% |
Generated by coverage-comment.yml
sokoliva
reviewed
Apr 27, 2026
Comment on lines
12
to
+33
| from a2a.types.a2a_pb2 import ( | ||
| AgentCard, | ||
| AgentCapabilities, | ||
| AgentInterface, | ||
| AgentCard, | ||
| ) | ||
| from a2a.types.a2a_pb2 import ( | ||
| Message as Message10, | ||
| ) | ||
| from a2a.types.a2a_pb2 import ( | ||
| Part as Part10, | ||
| ) | ||
| from a2a.types.a2a_pb2 import ( | ||
| Role as Role10, | ||
| ) | ||
| from a2a.types.a2a_pb2 import ( | ||
| Task as Task10, | ||
| TaskStatus as TaskStatus10, | ||
| ) | ||
| from a2a.types.a2a_pb2 import ( | ||
| TaskState as TaskState10, | ||
| ) | ||
|
|
||
| from a2a.compat.v0_3 import a2a_v0_3_pb2 | ||
| from a2a.types.a2a_pb2 import ( | ||
| TaskStatus as TaskStatus10, | ||
| ) |
Member
There was a problem hiding this comment.
Let's use "combine-as-imports = true" so that imports like these don't get fragmated.
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.
Summary
Why
The repository currently formats files under
tests/, but skips linting them entirely in CI. This leaves basic, deterministic issues like unused imports, redefinitions, and import ordering unreported.This change keeps the main Ruff configuration unchanged and adds a narrow test-only check for
F401,F811, andI001.Includes a small follow-up adjustment to one existing legacy streaming scenario test after CI exposed a flaky Python 3.14 path.
Validation
uv run ruff check --output-format=githubuv run ruff check tests --config ruff-tests.toml --output-format=githubuv run ruff format --checkuv run pytest -q tests/client/test_base_client.py tests/server/events/test_event_consumer.py tests/server/request_handlers/test_default_request_handler.py tests/server/routes/test_jsonrpc_dispatcher.py