Skip to content

test(gazelle): Update remove_invalid_(binary|library) gazelle tests.#3601

Open
dougthor42 wants to merge 1 commit intobazel-contrib:mainfrom
dougthor42:u/dthor/fixup-tests
Open

test(gazelle): Update remove_invalid_(binary|library) gazelle tests.#3601
dougthor42 wants to merge 1 commit intobazel-contrib:mainfrom
dougthor42:u/dthor/fixup-tests

Conversation

@dougthor42
Copy link
Collaborator

Update remove_invalid_(binary|library) gazelle tests.

These changes will make a little more sense in a followup PR that finishes the "delete invalid targets" work started in #3046. In that PR, I pushed back on changes that would mean py_test and py_library targets got removed if they were invalid (see #3046 (review)).

It's now time to fix that and make it so any invalid target, not just py_binary, is removed see #3046 (comment)). That change will come in a followup PR.

This PR updates tests by adding some always-valid targets and does some light renaming of the targets.

These changes will make a little more sense in a followup PR that
finishes the "delete invalid targets" work started in bazel-contrib#3046. In that PR,
I pushed back on changes that resulted in py_test and py_library targets
getting removed if they were invalid (see
bazel-contrib#3046 (review)
and
bazel-contrib#3046 (comment)).

This PR updates tests by adding some always-valid targets and does some
light renaming of the targets.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dougthor42, 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 refines the Gazelle test suite for Python rules, specifically updating tests related to the removal of invalid build targets. The changes are a preparatory step for a subsequent PR that will expand the invalid target removal logic to encompass py_test and py_library rules, ensuring comprehensive cleanup of malformed targets. The current updates involve renaming existing targets and adding new valid ones to better simulate future scenarios.

Highlights

  • Test Suite Refinement: Updated existing Gazelle tests for remove_invalid_binary and remove_invalid_library scenarios.
  • Future-Proofing Invalid Target Removal: Prepared test cases for an upcoming change that will enable the removal of all invalid targets, including py_test and py_library, not just py_binary.
  • Test Case Enhancements: Introduced new, always-valid targets and performed minor renaming of existing targets within the test files to improve clarity and coverage.

🧠 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
  • gazelle/python/testdata/remove_invalid_binary/BUILD.in
    • Renamed py_library target from "keep_library" to "remove_invalid_binary" and added srcs = ["__init__.py"].
    • Renamed py_binary target from "remove_invalid_binary" to "remove_invalid_binary_bin".
  • gazelle/python/testdata/remove_invalid_binary/BUILD.out
    • Renamed py_library target from "keep_library" to "remove_invalid_binary", added srcs = ["__init__.py"], and visibility = ["//:__subpackages__"].
  • gazelle/python/testdata/remove_invalid_library/BUILD.in
    • Added py_test to the load statement.
    • Introduced a new py_test target named "my_test" with srcs = ["my_test.py"].
  • gazelle/python/testdata/remove_invalid_library/BUILD.out
    • Added py_test to the load statement.
    • Introduced a new py_test target named "my_test" with srcs = ["my_test.py"].
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request 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
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

The pull request updates the Gazelle integration tests for Python by adding valid targets and renaming existing ones in the remove_invalid_binary and remove_invalid_library test cases. These changes correctly set up the expected state for Gazelle's current behavior and prepare for future improvements in how invalid targets are handled. The modifications to the BUILD.in and BUILD.out files are consistent with Gazelle's rule generation and merging logic, ensuring that valid targets are maintained while invalid ones are correctly identified for removal.

@dougthor42 dougthor42 marked this pull request as ready for review February 16, 2026 08:13
@dougthor42 dougthor42 requested a review from aignas as a code owner February 16, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant