tests: make precompile tests pass when other toolchains are defined #2213
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.
This makes the precompile_tests pass when the environment defines custom toolchains that
don't match what rules_python defines in its dev environment. This keeps the tests
independent of whatever the user's environment is.
Basically, the tests rely on a fake Python version 4.5 toolchain for the precompiler being
defined. They pass today because they fallback to a real toolchain (as setup by
MODULE.bazel), which doesn't have any version constraints on it. In comparison, within
Google, there is no "default" toolchain, so the tests fail to find what they need.
To fix, explicitly define a fake precompiler toolchain and tell the test to use it.
Along the way:
--allow_unresolved_symlinks=true
in the tests. This flag isn't enabled incertain environments, but is implicitly relied upon by the
current_interpreter_executable
rule when a platform runtime is used (as they are inthe tests).
testing toolchains were moved.