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

python: fix bazel py_test testSmoke for Python 3.11+ #20738

Closed
wants to merge 1 commit into from

Conversation

rickeylev
Copy link
Contributor

The test was failing because the b.py file couldn't be imported because, starting with Python 3.11, the PYTHONSAFEPATH environment variable (set by the bootstrap startup) is respected. This setting inhibits the default Python behavior of adding the main script's directory to sys.path.

To fix, use py_library.imports to explicitly add the necessary directory to sys.path.

Fixes #20660

The test was failing because the `b.py` file couldn't be imported
because, starting with Python 3.11, the `PYTHONSAFEPATH` environment
variable (set by the bootstrap startup) is respected. This setting
inhibits the default Python behavior of adding the main script's
directory to sys.path.

To fix, use `py_library.imports` to explicitly add the necessary
directory to `sys.path`.

Fixes bazelbuild#20660
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.

//src/test/py/bazel:py_test is broken with Python 3.11
1 participant