fix(gazelle): correct runfiles path handling in gazelle_python_manifest test by timfallmk · Pull Request #3398 · bazel-contrib/rules_python
…st test The gazelle_python_manifest test was failing on Linux but passing on macOS due to incorrect file path handling. The test used $(rootpath) instead of $(rlocationpath) for data files and didn't use the resolved runfiles paths returned by runfiles.Rlocation(). Changes: - Update defs.bzl to use $(rlocationpath) for _TEST_MANIFEST and _TEST_REQUIREMENTS environment variables (matching the existing pattern for _TEST_MANIFEST_GENERATOR_HASH) - Fix test.go to use the resolved paths from runfiles.Rlocation() instead of the unresolved paths at lines 53, 73, and 84-86 This ensures the test works consistently across all platforms by properly using the Bazel runfiles mechanism. Fixes #3397 Note: Some code generation was assisted by Claude AI. The human author has reviewed, tested, and takes full responsibility for all changes.
Address code review feedback from Gemini Code Assist bot by creating a getResolvedRunfile helper function. This reduces code duplication and improves error messages by consolidating the logic for: - Getting environment variable values - Validating they are set - Resolving paths through runfiles.Rlocation() Applied the helper to all three environment variables: - _TEST_REQUIREMENTS - _TEST_MANIFEST - _TEST_MANIFEST_GENERATOR_HASH This reduces ~20 lines of duplicated code to 3 function calls and provides more specific error messages that include the env var name and unresolved path. Addresses: #3398 (comment)
timfallmk
deleted the
tfall/fix-rules-python-gazelle-plugin-requirements-data-paths
branch
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