Skip to content

[CI]Style: Convert test/ to ruff format(Batch #6)#7141

Merged
wangxiyuan merged 1 commit intovllm-project:mainfrom
MrZ20:lint-test-6
Apr 21, 2026
Merged

[CI]Style: Convert test/ to ruff format(Batch #6)#7141
wangxiyuan merged 1 commit intovllm-project:mainfrom
MrZ20:lint-test-6

Conversation

@MrZ20
Copy link
Copy Markdown
Contributor

@MrZ20 MrZ20 commented Mar 11, 2026

What this PR does / why we need it?

File Path
tests/ut/batch_invariant/test_batch_invariant.py
tests/ut/compilation/test_acl_graph.py
tests/ut/compilation/test_npugraph_ex_utils_check.py
tests/ut/conftest.py
tests/ut/core/test_scheduler_dynamic_batch.py
tests/ut/device_allocator/test_camem.py
tests/ut/device_allocator/test_cpu_binding.py
tests/ut/distributed/device_communicators/test_pyhccl.py
tests/ut/distributed/device_communicators/test_pyhccl_wrapper.py
tests/ut/distributed/mooncake/test_config_data.py
tests/ut/distributed/test_communicator.py
tests/ut/distributed/test_parallel_state.py
tests/ut/eplb/adaptor/test_vllm_adaptor.py
tests/ut/eplb/core/policy/test_policy_abstract.py
tests/ut/eplb/core/policy/test_policy_default_eplb.py
tests/ut/eplb/core/policy/test_policy_factor.py
tests/ut/eplb/core/policy/test_policy_swift_balancer.py
tests/ut/eplb/core/test_eplb_device_transfer_loader.py
tests/ut/eplb/core/test_eplb_utils.py
tests/ut/spec_decode/test_eagle_proposer.py
tests/ut/test_ascend_config.py
tests/ut/test_envs.py
tests/ut/test_platform.py
tests/ut/test_utils.py
tests/ut/worker/test_block_table.py
tests/ut/worker/test_pcp_manager.py
tests/ut/worker/test_worker_v1.py

Does this PR introduce any user-facing change?

How was this patch tested?

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the code quality and maintainability of the project's unit test suite. By integrating a new set of test files into the Ruff formatting pipeline, it ensures a more uniform and readable codebase. The changes primarily involve stylistic adjustments, import organization, and minor refactorings to align with modern Python best practices, contributing to a more streamlined development workflow.

Highlights

  • Ruff Formatting Adoption: Expanded Ruff linting coverage to a new batch of tests/ut/ files by removing them from the exclude list in pyproject.toml.
  • Code Style Consistency: Applied consistent code formatting across numerous Python test files, including import reordering, line wrapping adjustments, and standardized argument formatting in function calls and decorators.
  • Type Hint Modernization: Updated Python type hints in tests/ut/core/test_scheduler_dynamic_batch.py from Optional[list[...]] to list[...] | None and Dict[str, Any] to dict[str, Any] for improved readability and modern Python syntax.
  • Redundant Code Removal: Cleaned up unused local variables in tests/ut/batch_invariant/test_batch_invariant.py to reduce clutter and improve code clarity.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • pyproject.toml
    • Updated Ruff exclusion list to include more tests/ut/ subdirectories for linting.
  • tests/ut/_310p/quantization/test_modelslim_config_310.py
    • Reordered imports for consistency.
  • tests/ut/_310p/quantization/test_w8a8sc_310.py
    • Standardized tuple formatting (e.g., (shape,) instead of (shape, )).
    • Reformatted multi-line function calls for improved readability.
  • tests/ut/batch_invariant/test_batch_invariant.py
    • Removed unused local variables mock_torch, batch_size, and hidden_size.
  • tests/ut/compilation/test_acl_graph.py
    • Reordered imports.
    • Reformatted multi-line function calls and patch decorators.
  • tests/ut/compilation/test_npugraph_ex_utils_check.py
    • Reordered imports.
    • Reformatted multi-line test assertions for clarity.
  • tests/ut/conftest.py
    • Converted string literals from single to double quotes.
  • tests/ut/core/test_scheduler_dynamic_batch.py
    • Updated type hints to use modern Python syntax (e.g., | None for optional types).
    • Reformatted multi-line function calls and dictionary definitions.
  • tests/ut/device_allocator/test_camem.py
    • Reordered imports.
    • Reformatted multi-line pytest.mark.parametrize and patch decorators.
  • tests/ut/device_allocator/test_cpu_binding.py
    • Reordered imports.
    • Reformatted multi-line patch decorators and string literals.
  • tests/ut/distributed/device_communicators/test_pyhccl.py
    • Reordered imports.
    • Reformatted multi-line patch decorators.
  • tests/ut/distributed/device_communicators/test_pyhccl_wrapper.py
    • Reordered imports.
    • Reformatted multi-line function calls for improved readability.
  • tests/ut/distributed/mooncake/test_config_data.py
    • Reordered imports.
    • Reformatted multi-line function calls.
  • tests/ut/distributed/test_communicator.py
    • Reordered imports.
    • Reformatted multi-line patch decorators and list assignments.
  • tests/ut/distributed/test_parallel_state.py
    • Reordered imports.
    • Reformatted multi-line patch decorators.
  • tests/ut/eplb/adaptor/test_vllm_adaptor.py
    • Reordered imports.
    • Ensured file ends with a newline character.
  • tests/ut/eplb/core/policy/test_policy_abstract.py
    • Reordered imports.
  • tests/ut/eplb/core/policy/test_policy_default_eplb.py
    • Reordered imports.
    • Reformatted multi-line function calls and patch decorators.
  • tests/ut/eplb/core/policy/test_policy_factor.py
    • Reordered imports.
    • Reformatted multi-line pytest.mark.parametrize decorator.
  • tests/ut/eplb/core/policy/test_policy_swift_balancer.py
    • Removed unused Dict and Set imports.
    • Reformatted multi-line function calls.
  • tests/ut/eplb/core/test_eplb_device_transfer_loader.py
    • Reordered imports.
    • Reformatted multi-line patch decorators.
  • tests/ut/eplb/core/test_eplb_utils.py
    • Reordered imports.
    • Reformatted multi-line FusedMoEParallelConfig calls.
  • tests/ut/spec_decode/test_eagle_proposer.py
    • Reordered imports.
    • Reformatted multi-line string literals, patch decorators, and function calls.
  • tests/ut/test_ascend_config.py
    • Reordered imports.
    • Reformatted multi-line dictionary assignments.
  • tests/ut/test_envs.py
    • Reordered imports.
    • Converted string literals from single to double quotes.
  • tests/ut/test_platform.py
    • Reordered imports.
    • Reformatted multi-line patch decorators.
  • tests/ut/test_utils.py
    • Removed unused Lock import.
    • Reordered imports.
    • Reformatted multi-line tensor initializations, pytest.mark.skip decorators, and mock.patch calls.
  • tests/ut/worker/test_block_table.py
    • Reordered imports.
    • Reformatted multi-line patch decorators and string literals.
  • tests/ut/worker/test_pcp_manager.py
    • Reordered imports.
    • Reformatted multi-line pytest.mark.parametrize and PCPManager instantiations.
  • tests/ut/worker/test_worker_v1.py
    • Reordered imports.
    • Converted string literals from single to double quotes.
    • Reformatted multi-line patch decorators and function calls.
Activity
  • The pull request was created by MrZ20.
  • The changes primarily involve applying ruff formatting to a batch of unit test files, as indicated by the title and the pyproject.toml modifications.
  • No human review comments or other activities have been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request applies ruff formatting to a batch of test files under tests/ut/. The changes are purely stylistic, including reformatting imports, function calls, and removing unused variables. The modifications correctly apply the linter rules and improve code consistency and readability without altering functionality. I have reviewed the changes and found no issues.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@MrZ20 MrZ20 marked this pull request as ready for review March 18, 2026 11:32
@MrZ20 MrZ20 requested a review from wangxiyuan as a code owner March 18, 2026 11:32
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@MrZ20 MrZ20 changed the title [Lint]Style: Convert test/ to ruff format(Batch #6) [CI]Style: Convert test/ to ruff format(Batch #6) Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Signed-off-by: MrZ20 <2609716663@qq.com>
@wangxiyuan wangxiyuan merged commit 5d178a7 into vllm-project:main Apr 21, 2026
36 checks passed
@MrZ20 MrZ20 deleted the lint-test-6 branch April 21, 2026 03:13
tfhddd pushed a commit to ascend-gha-runners/vllm-ascend that referenced this pull request Apr 21, 2026
### What this PR does / why we need it?
| File Path |
| :--- |
| `tests/ut/batch_invariant/test_batch_invariant.py` |
| `tests/ut/compilation/test_acl_graph.py` |
| `tests/ut/compilation/test_npugraph_ex_utils_check.py` |
| `tests/ut/conftest.py` |
| `tests/ut/core/test_scheduler_dynamic_batch.py` |
| `tests/ut/device_allocator/test_camem.py` |
| `tests/ut/device_allocator/test_cpu_binding.py` |
| `tests/ut/distributed/device_communicators/test_pyhccl.py` |
| `tests/ut/distributed/device_communicators/test_pyhccl_wrapper.py` |
| `tests/ut/distributed/mooncake/test_config_data.py` |
| `tests/ut/distributed/test_communicator.py` |
| `tests/ut/distributed/test_parallel_state.py` |
| `tests/ut/eplb/adaptor/test_vllm_adaptor.py` |
| `tests/ut/eplb/core/policy/test_policy_abstract.py` |
| `tests/ut/eplb/core/policy/test_policy_default_eplb.py` |
| `tests/ut/eplb/core/policy/test_policy_factor.py` |
| `tests/ut/eplb/core/policy/test_policy_swift_balancer.py` |
| `tests/ut/eplb/core/test_eplb_device_transfer_loader.py` |
| `tests/ut/eplb/core/test_eplb_utils.py` |
| `tests/ut/spec_decode/test_eagle_proposer.py` |
| `tests/ut/test_ascend_config.py` |
| `tests/ut/test_envs.py` |
| `tests/ut/test_platform.py` |
| `tests/ut/test_utils.py` |
| `tests/ut/worker/test_block_table.py` |
| `tests/ut/worker/test_pcp_manager.py` |
| `tests/ut/worker/test_worker_v1.py` |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.16.0
- vLLM main:
vllm-project/vllm@4034c3d

Signed-off-by: MrZ20 <2609716663@qq.com>
Signed-off-by: tfhddd <2272751277@qq.com>
anning-2026 pushed a commit to anning-2026/vllm-ascend that referenced this pull request Apr 21, 2026
…-project#7141)

### What this PR does / why we need it?
| File Path |
| :--- |
| `tests/ut/batch_invariant/test_batch_invariant.py` |
| `tests/ut/compilation/test_acl_graph.py` |
| `tests/ut/compilation/test_npugraph_ex_utils_check.py` |
| `tests/ut/conftest.py` |
| `tests/ut/core/test_scheduler_dynamic_batch.py` |
| `tests/ut/device_allocator/test_camem.py` |
| `tests/ut/device_allocator/test_cpu_binding.py` |
| `tests/ut/distributed/device_communicators/test_pyhccl.py` |
| `tests/ut/distributed/device_communicators/test_pyhccl_wrapper.py` |
| `tests/ut/distributed/mooncake/test_config_data.py` |
| `tests/ut/distributed/test_communicator.py` |
| `tests/ut/distributed/test_parallel_state.py` |
| `tests/ut/eplb/adaptor/test_vllm_adaptor.py` |
| `tests/ut/eplb/core/policy/test_policy_abstract.py` |
| `tests/ut/eplb/core/policy/test_policy_default_eplb.py` |
| `tests/ut/eplb/core/policy/test_policy_factor.py` |
| `tests/ut/eplb/core/policy/test_policy_swift_balancer.py` |
| `tests/ut/eplb/core/test_eplb_device_transfer_loader.py` |
| `tests/ut/eplb/core/test_eplb_utils.py` |
| `tests/ut/spec_decode/test_eagle_proposer.py` |
| `tests/ut/test_ascend_config.py` |
| `tests/ut/test_envs.py` |
| `tests/ut/test_platform.py` |
| `tests/ut/test_utils.py` |
| `tests/ut/worker/test_block_table.py` |
| `tests/ut/worker/test_pcp_manager.py` |
| `tests/ut/worker/test_worker_v1.py` |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.16.0
- vLLM main:
vllm-project/vllm@4034c3d

Signed-off-by: MrZ20 <2609716663@qq.com>
guxin108 pushed a commit to guxin108/vllm-ascend that referenced this pull request Apr 24, 2026
…-project#7141)

### What this PR does / why we need it?
| File Path |
| :--- |
| `tests/ut/batch_invariant/test_batch_invariant.py` |
| `tests/ut/compilation/test_acl_graph.py` |
| `tests/ut/compilation/test_npugraph_ex_utils_check.py` |
| `tests/ut/conftest.py` |
| `tests/ut/core/test_scheduler_dynamic_batch.py` |
| `tests/ut/device_allocator/test_camem.py` |
| `tests/ut/device_allocator/test_cpu_binding.py` |
| `tests/ut/distributed/device_communicators/test_pyhccl.py` |
| `tests/ut/distributed/device_communicators/test_pyhccl_wrapper.py` |
| `tests/ut/distributed/mooncake/test_config_data.py` |
| `tests/ut/distributed/test_communicator.py` |
| `tests/ut/distributed/test_parallel_state.py` |
| `tests/ut/eplb/adaptor/test_vllm_adaptor.py` |
| `tests/ut/eplb/core/policy/test_policy_abstract.py` |
| `tests/ut/eplb/core/policy/test_policy_default_eplb.py` |
| `tests/ut/eplb/core/policy/test_policy_factor.py` |
| `tests/ut/eplb/core/policy/test_policy_swift_balancer.py` |
| `tests/ut/eplb/core/test_eplb_device_transfer_loader.py` |
| `tests/ut/eplb/core/test_eplb_utils.py` |
| `tests/ut/spec_decode/test_eagle_proposer.py` |
| `tests/ut/test_ascend_config.py` |
| `tests/ut/test_envs.py` |
| `tests/ut/test_platform.py` |
| `tests/ut/test_utils.py` |
| `tests/ut/worker/test_block_table.py` |
| `tests/ut/worker/test_pcp_manager.py` |
| `tests/ut/worker/test_worker_v1.py` |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.16.0
- vLLM main:
vllm-project/vllm@4034c3d

Signed-off-by: MrZ20 <2609716663@qq.com>
Signed-off-by: guxin108 <1252896542@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants