Skip to content

Conversation

rickeylev
Copy link
Collaborator

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:

  • Also force --allow_unresolved_symlinks=true in the tests. This flag isn't enabled in
    certain environments, but is implicitly relied upon by the
    current_interpreter_executable rule when a platform runtime is used (as they are in
    the tests).
  • Move the Python testing toolchains to support/py_toolchains, to match where the cc
    testing toolchains were moved.

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.

Along the way:
* Also force `--allow_unresolved_symlinks=true` in the tests. This flag
  isn't enabled in certain environments, but is implicitly relied upon
  by the `current_interpreter_executable` rule when a platform runtime
  is used (as they are in the tests).
* Move the Python testing toolchains to support/py_toolchains, to match
  where the cc testing toolchains were moved.
@rickeylev rickeylev requested a review from oprypin September 10, 2024 21:08
@rickeylev rickeylev marked this pull request as ready for review September 10, 2024 21:31
@rickeylev rickeylev requested a review from aignas as a code owner September 10, 2024 21:31
@rickeylev rickeylev added this pull request to the merge queue Sep 10, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 10, 2024
…2213)

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:
* Also force `--allow_unresolved_symlinks=true` in the tests. This flag
isn't enabled in
  certain environments, but is implicitly relied upon by the
`current_interpreter_executable` rule when a platform runtime is used
(as they are in
  the tests).
* Move the Python testing toolchains to support/py_toolchains, to match
where the cc
  testing toolchains were moved.
@rickeylev rickeylev removed this pull request from the merge queue due to a manual request Sep 10, 2024
@rickeylev rickeylev added this pull request to the merge queue Sep 10, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 10, 2024
…2213)

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:
* Also force `--allow_unresolved_symlinks=true` in the tests. This flag
isn't enabled in
  certain environments, but is implicitly relied upon by the
`current_interpreter_executable` rule when a platform runtime is used
(as they are in
  the tests).
* Move the Python testing toolchains to support/py_toolchains, to match
where the cc
  testing toolchains were moved.
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 10, 2024
@rickeylev rickeylev added this pull request to the merge queue Sep 10, 2024
Merged via the queue into bazel-contrib:main with commit 7d42a93 Sep 10, 2024
4 checks passed
@rickeylev rickeylev deleted the fix.custom.exec.toolchains branch September 10, 2024 23:34
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.

2 participants