-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Resolve symlinks in the import path #1253
Conversation
I wonder if this also fix pylint-dev/pylint#4798. (We could ping DudeNr33 if no one can test this on Mac) |
@Pierre-Sassoulas Just checked, it does! pylint 2.11 w/ astroid 2.8.5
pylint 2.11 w/ astroid (this branch)
Would you like me to update the change log? |
Do we think pylint-dev/pylint#4798 is indeed similar to pylint-dev/pylint#4759? We could then also close that issue! |
I think #4759 would be valuable to do even if we fixed this particular issue thanks to @keichi |
Yes please :) And thank you for fixing this issue in the first place, it's really hard to investigate without access to a Mac ! |
Yep, the problems reported in pylint-dev/pylint#4759 are fixed 🎉 Maybe we can run macOS CI jobs in this repository too? |
8d4ea3a
to
7f213b6
Compare
7f213b6
to
e09c08e
Compare
Turns out this fixes pylint-dev/pylint#4302 and pylint-dev/pylint#5081 as well. |
pylint-dev/pylint#3499 is also fixed. To summarize, here are the pylint issues resolved with this PR: |
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.
Wow, so many fixes at once, this is 🔥
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.
Sorry, I missed that this was not merged yet with the release of pylint 2.12. Thanks a lot for the numerous fixes !
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.
Can't leave this opportunity to add the typing already.
Should we add tests to this?
I think pylint-dev/pylint#4759 would be part of the solution ? But there might be a trick to test if on any platform ? |
Co-authored-by: Daniël van Noord <[email protected]>
I think we should add a test specific to this. I'm not sure: can we create a temporary symlink with |
Unit testing is not really hard, maybe a mix of |
I don't really follow you here 😅 What do you mean with integration testing (I'm not that experienced with testing frameworks so forgive me if this is obvious)? |
By integration testing I mean the generic computer science term, i.e. testing that modules using this new |
I have a Mac so I'll work on creating a test for this. I played around for a bit already and noticed that one test is actually breaking because of this change on Mac, so this can't be merged in its current state. |
I looked into this but I'm not sure we can create a test. The problem is not that what we import contains a symlink but that the I don't think we can add a symlink to the python executable/directory while we are already running a python instance.. Setting up a completely new action with a symlinked install of python just to test this does not seem worth it. I think we should go ahead and merge this without tests (sadly..) |
I came to the same conclusion. I think the lack of tests is the reason why we did not merge this earlier. Some things are really hard to test. So really useful MR are rotting in astroid because of that. Same problem with #1207, it's not impossible to test, but it's hard. |
Can we auto-close the |
Generally I add a regression test in pylint before closing but right now testing is just as hard. I added them to the 2.13.0 milestone but we could close it when upgrading pylint to astroid 2.9.1 ? |
Fine with me! |
This is a regression test for pylint-dev/astroid#1253 Closes #1470
* Resolve symlinks in the import path * Drop expanduser() from _normalize_path() and add note Co-authored-by: Pierre Sassoulas <[email protected]> Co-authored-by: Daniël van Noord <[email protected]>
This is a regression test for pylint-dev/astroid#1253 Closes #1470
This is a regression test for pylint-dev/astroid#1253 Closes #1470
This is a regression test for pylint-dev/astroid#1253 Closes pylint-dev#1470
Currently, module import fails when the import path contains a symlink.
An example is Python installed on macOS using Homebrew where
/opt/homebrew/opt/python
is a symlink to/opt/homebrew/Cellar/[email protected]/3.9.8
(exact version varies). As a result,get_python_lib(standard_lib=True)
returns/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9
whilesys.path
is[..., '/opt/homebrew/Cellar/[email protected]/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9', ...]
. The following tests fail due to this inconsistency:Description
Type of Changes
Related Issue
Fixes #823