-
Notifications
You must be signed in to change notification settings - Fork 543
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: ignore_root_user_error should be taken from root module only #1662
fix: ignore_root_user_error should be taken from root module only #1662
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
2fbb06b
to
a73c85f
Compare
Also, remember the root might might not explicitly setup any python toolchains; it might only be getting one because of some transitive module that needs python. And yes, only the root module should be able to set |
a73c85f
to
9783eaa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it needs a CHANGELOG snippet and it wouldbe great to have the PR description to be a nice summary of the change as well as it will be used as a commit message when the PR gets merged.
4d55aef
to
4015895
Compare
@shabanzd could you think of a way to add an integration test for this? The |
I originally requested tests when Ignas asked me about this PR, but I'm not so sure we should block on that now. The only idea I have for testing this is to add some print statements and check their output in the integration test. The prints would be guarded by an environment variable. However, doing that requires setting up a new test runner for the integration tests (one that can capture output and assert on it), which is maybe a bit too much to ask a new contributor in this PR. Any alternative testing ideas that might be easier? |
I would agree with @aignas that maybe the simplest way would be to have |
Ah, that gives me an idea: write an extra file somewhere with some info about what the extension did. Guard this behind an environment variable. Then we can write a test inside the integration test that reads that file and verifies its content. Maybe have the python repository repo rule write out what its settings were? Then it should be easy to use_repo() it and locate the file within it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an integration test to verify behavior. It works as I described last: the extension checks an environment variable and writes a file with some debug info. A test reads it to verify what happened. Overall it works pretty well and isn't very invasive; we can probably use this same technique to test other subtle cases with the bzlmod extension code.
Sorry was offline since Thursday, thanks for taking care of the testing @rickeylev 🙏🏼🙏🏼 |
Only the root module should be able to decide
ignore_root_user_error
. Modules being depended upon don't know the final environment, so they aren't in the right position to know or decide what the correct setting is. This PR implements a solution to take theignore_root_user_error
value from the root module only.Fixes #1658