You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(gazelle): correct runfiles path handling in gazelle_python_manifest test (#3398)
## Summary
This PR fixes the `gazelle_python_manifest.test` failure on Linux CI by
correcting the runfiles path handling in both the Bazel rule definition
and the Go test code.
Fixes#3397
## Problem
The test was failing on Linux but passing on macOS due to inconsistent
file path handling:
- Used `$(rootpath)` instead of `$(rlocationpath)` in the Bazel rule
- Resolved runfiles paths but then didn't use the resolved values
See issue #3397 for full technical details.
## Changes
### `gazelle/manifest/defs.bzl`
- Line 120: Changed `$(rootpath)` to `$(rlocationpath)` for
`_TEST_MANIFEST`
- Line 122: Changed `$(rootpath)` to `$(rlocationpath)` for
`_TEST_REQUIREMENTS`
This makes them consistent with the existing
`_TEST_MANIFEST_GENERATOR_HASH` which already used `$(rlocationpath)`.
### `gazelle/manifest/test/test.go`
- Line 53: Use `manifestPathResolved` instead of `manifestPath` in
`manifestFile.Decode()`
- Line 73: Use `requirementsPathResolved` instead of `requirementsPath`
in `os.Open()`
- Lines 84-86: Use `manifestPathResolved` instead of `manifestPath` in
error handling
The test was already calling `runfiles.Rlocation()` to resolve the
paths, but then wasn't using the resolved values.
## Testing
Tested on Linux by running:
```bash
cd gazelle/examples/bzlmod_build_file_generation
bazel test //:gazelle_python_manifest.test
```
Result: ✅ **PASSED**
## Notes
- This fix aligns with Bazel's recommended runfiles handling practices
- All changes follow the existing pattern used for
`_TEST_MANIFEST_GENERATOR_HASH`
- Some code generation was assisted by Claude AI, but the human author
has reviewed, tested, and takes full responsibility for all changes per
the [contribution
guidelines](https://github.com/bazel-contrib/rules_python/blob/main/CONTRIBUTING.md#ai-assisted-contributions)
**Disclaimer**: This is my first contribution to this project, so I'm
not entirely certain this is the correct contribution method. Please let
me know if any changes to the PR process are needed. Happy to make
adjustments!
* (gazelle) Fix `gazelle_python_manifest.test` so that it accesses manifest files via `runfile` path handling rather than directly ([#3397](https://github.com/bazel-contrib/rules_python/issues/3397)).
0 commit comments