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

fix: Prefix bootstrap file to prevent pytest reentrance #2230

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

mortenmj
Copy link
Contributor

@mortenmj mortenmj commented Sep 17, 2024

Pytest will, by default, discover tests in files named test_*.py. The existing behaviour of the bootstrap setup is to create a file named e.g. test_foo_stage2_bootstrap.py for a target named test_foo. This causes pytest to reenter, leading to a crash.

To fix, prepend the generated stage2 file with an underscore so that pytest doesn't match it.

Copy link
Contributor

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, just some small doc changes needed. I suggested an edit for one. Can you please add some text to CHANGELOG.md, too? e.g. under the fixed header, add something like:

* (rules) Prevent pytest from trying run the generated stage2
  bootstrap .py file when using {obj}`--bootstrap_impl=script`

python/private/common/py_executable_bazel.bzl Show resolved Hide resolved
@rickeylev rickeylev added this pull request to the merge queue Sep 17, 2024
Merged via the queue into bazelbuild:main with commit 27276b6 Sep 17, 2024
4 checks passed
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