Repository navigation
Silence modules in site-packages and typeshed - #5303
Conversation
|
Huh, this is strange: I suppose the map messes things up. |
|
@ethanhs Is this a regression or it was always like this? (There is a chance this is related to a recent overload overhaul.) |
Not sure, I created the repro with https://mypy-play.net, which uses 0.610, I haven't tested it on older versions. |
|
No, it is a The fix should be straightforward, but if you don't have time, just open an issue about this. |
ilevkivskyi
left a comment
There was a problem hiding this comment.
The code looks good, but I think we should add a test that installs a PEP 561 with various errors (both import related and non-import-related) to be sure they are all silenced.
| main:2: error: Incompatible types in assignment (expression has type "int", variable has type "str") | ||
|
|
||
| [case testAddFileWhichImportsLibModuleWithErrors] | ||
| # flags: --no-silence-site-packages |
There was a problem hiding this comment.
Why is this necessary here? Is broken installed as a PEP 561 package?
There was a problem hiding this comment.
Since opening this, I also implemented silencing typeshed, which broken is simulated as being part of via alt_lib_path.
|
|
||
| # backport commonpath for 3.4 | ||
| if sys.platform == 'win32': | ||
| def commonpath(paths: Sequence[str]) -> str: |
There was a problem hiding this comment.
Do we need the general algorithm here? As I understand we essentially only need something like is_sub_path(p1, p2). Not that I think it is important, but maybe it will allow to simplify code?
There was a problem hiding this comment.
I was originally hoping to eventually use os.path.commonpath once we drop support for 3.4, but I think you are right it would be better to do this ourselves. I will change this when I have time later.
I will add some errors to typedpkg to test the functionality. |
OK, thanks! Just note that I would like to cut the release branch tomorrow morning. So it would be better to have the tests by that time. |
Sure thing, I will do that momentarily. |
Fixes #5260 .