Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(bzlmod): Make some tests bzlmod compatible with Bazel@HEAD #1482

Merged
merged 3 commits into from
Oct 11, 2023

Conversation

rickeylev
Copy link
Collaborator

A few tests weren't compatible with bzlmod, so would fail when it was enabled. The various causes and fixes are:

  • Under bzlmod, runfiles.CurrentRepository() returns the empty string for the main repository. To fix, an environment variable is used to tell the test whether bzlmod is enabled or not.

  • Accessing data files through TEST_SRCDIR directly is error-prone under bzlmod because the directory name within runfiles changes from the workspace name to _main. To fix, use the runfiles libraries, which know how to map apparent repo names to the actual directory name. In the integration tests, the runfiles library isn't available, so just check for the _main directory instead.

Work towards #1469

examples/wheel/wheel_test.py Outdated Show resolved Hide resolved
A few tests weren't compatible with bzlmod, so would fail when it was
enabled. The various causes and fixes are:

* Under bzlmod, `runfiles.CurrentRepository()` returns the empty string
  for the main repository. To fix, an environment variable is used to
  tell the test whether bzlmod is enabled or not.

* Accessing data files through `TEST_SRCDIR` directly is error-prone
  under bzlmod because the directory name within runfiles changes from
  the workspace name to `_main`. To fix, use the runfiles libraries,
  which know how to map apparent repo names to the actual directory
  name. In the integration tests, the runfiles library isn't available,
  so just check for the `_main` directory instead.

Work towards bazelbuild#1469
@rickeylev rickeylev enabled auto-merge October 11, 2023 04:35
@rickeylev rickeylev added this pull request to the merge queue Oct 11, 2023
Merged via the queue into bazelbuild:main with commit cf3cdc1 Oct 11, 2023
1 check passed
@rickeylev rickeylev deleted the bzlmod-default branch December 19, 2023 01:15
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