-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-135788: Support NETRC environment variable in netrc
8000
#135802
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
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
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.
Avoid verbose comments in tests in general unless they are needed. Most of the time, the code is small enough to understand what happens without the needs of a docstring.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
envvar_netrc = os.environ.get("NETRC", "") | ||
home_netrc = os.path.join(os.path.expanduser("~"), ".netrc") | ||
file = file or envvar_netrc or home_netrc | ||
default_netrc = (file == home_netrc) |
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.
The paths may be different but resolve to the same file.
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.
Could you please elaborate more? what's the expected behavior in that case?
netrc
So there is some WASI issue because of some missing OS function. I think it's because we previously never tested some code path that used that function, hence the issue. For now just ignore this failure. |
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.
So the WASI issue is in netrc.py
itself and the default_netrc
stuff.
I suspect that the if os.name == 'posix'
check is not sufficient and we need if hasattr(os, "getuid")
. We should have a separate PR and an other issue just for that, so for now you can skip the failing test on WASI (namely only the "use_default_netrc_in_home", not the others) and you should also document that this is not supported on WASI (when the PR fixing the WASI handling lands, we'll update that note, but until then the docs should be consistent and say that NETRC envvar is not supported on WASI)
I'll work on the WASI failure here #135815. If my PR lands before yours, then you won't need to change the test. I suggest not to change anything for now as I think I can fix it by the end of the day. |
The WASI test should be fixed. You can now resolve the conflicts (sorry for them!) |
No worries, and thanks for fixing that issue! |
I don't get why I get the |
I've restarted the CI job. It might be a false positive as it's under free-threading and we've had similar failures |
Commented on the issue, adding for visibility here: Multiple http libraries which use CPython's |
📚 Documentation preview 📚: https://cpython-previews--135802.org.readthedocs.build/