Skip to content

Conversation

@iancha1992
Copy link
Member

python: fix bazel py_test testSmoke for Python 3.11+
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

Closes #20738.

PiperOrigin-RevId: 595498775
Change-Id: I0c9521b210fe9e2c40692727fc87d41995e0968a

Commit 9b027c8

No public description
PiperOrigin-RevId: 694487395
Change-Id: I3f3e154ebfa932721d917661d61a878477a8e574

Commit be2186f

rickeylev and others added 2 commits December 13, 2024 09:09
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

Closes bazelbuild#20738.

PiperOrigin-RevId: 595498775
Change-Id: I0c9521b210fe9e2c40692727fc87d41995e0968a
PiperOrigin-RevId: 694487395
Change-Id: I3f3e154ebfa932721d917661d61a878477a8e574
@iancha1992 iancha1992 requested a review from a team as a code owner December 13, 2024 17:11
@iancha1992 iancha1992 added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website awaiting-review PR is awaiting review from an assigned reviewer labels Dec 13, 2024
@iancha1992 iancha1992 enabled auto-merge (squash) December 13, 2024 17:11
@iancha1992 iancha1992 changed the title [7.5.0] Backport https://github.com/bazelbuild/bazel/commit/9b027c88051797ada7350098ef190191b953014a and https://github.com/bazelbuild/bazel/commit/be2186fbe76ea52b9c146a5f01780a0171384ac8 to fix windows CI failures [7.5.0] Backport 9b027c88051797ada7350098ef190191b953014a and be2186fbe76ea52b9c146a5f01780a0171384ac8 to fix windows CI failures Dec 13, 2024
@iancha1992 iancha1992 changed the title [7.5.0] Backport 9b027c88051797ada7350098ef190191b953014a and be2186fbe76ea52b9c146a5f01780a0171384ac8 to fix windows CI failures [7.5.0] Backport 9b027c8 and be2186f to fix windows CI failures Dec 13, 2024
@iancha1992
Copy link
Member Author

Created as per: #24665 (comment)

@github-actions github-actions bot added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Dec 13, 2024
@iancha1992 iancha1992 merged commit a1f7f65 into bazelbuild:release-7.5.0 Dec 16, 2024
51 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Dec 16, 2024
@iancha1992 iancha1992 added this to the 7.5.0 release blockers milestone Dec 16, 2024
mbland pushed a commit to mbland/bazel that referenced this pull request Nov 14, 2025
…dows CI failures (bazelbuild#24691)

python: fix bazel py_test testSmoke for Python 3.11+
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

Closes bazelbuild#20738.

PiperOrigin-RevId: 595498775
Change-Id: I0c9521b210fe9e2c40692727fc87d41995e0968a

Commit
bazelbuild@9b027c8

No public description
PiperOrigin-RevId: 694487395
Change-Id: I3f3e154ebfa932721d917661d61a878477a8e574

Commit
bazelbuild@be2186f

---------

Co-authored-by: Richard Levasseur <[email protected]>
Co-authored-by: Googler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants