Repository navigation
stubtest: various improvements - #8502
Conversation
If runtime takes a keyword-only argument, we now unconditionally check that the stub also does. This leads to good outcomes on typeshed. Also further clarify the comments.
| if not whitelist[w]: | ||
| # Don't consider an entry unused if it regex-matches the empty string | ||
| # This allows us to whitelist errors that don't manifest at all on some systems | ||
| if not whitelist[w] and not whitelist_regexes[w].fullmatch(""): |
There was a problem hiding this comment.
I'm not sure I understand what's going on here. Could you give an example of a situation where this would apply?
There was a problem hiding this comment.
The motivation here is to create a way to provide a better experience for cases like python/typeshed#3782 where the whitelisted errors don't match up on some user's system.
For instance, on my system running stubtest gives me a number of (unfixable within current type system) errors like termios.B921600 is not present at runtime, but in CI we don't have any errors from termios at all. If we added a whitelist entry for termios.[A-Z0-9_]+, it would complain about an unused whitelist entry in CI. This allows us to add an entry for (termios.[A-Z0-9_]+)? so things work both on CI and on users' systems, and we can continue to detect unused whitelist entries in general.
This is tested by the unused_missing part of test_whitelist
Uh oh!
There was an error while loading. Please reload this page.