Skip to content

Commit 17b0a7a

Browse files
authored
stubtest: rewrite (#8325)
* stubtest: don't hardcode python version This will cause us to assume python version is sys.version_info, which is the behaviour we want, since we're comparing things to the runtime * stubtest: fix build * stubtest: recognise typealias * stubtest: use argparse, support custom typeshed dir * stubtest: [minor] blacken * stubtest: [minor] import nits * stubtest: [minor] renames, reorder parameters * stubtest: [wip] start to use runtime objects directly * stubtest: [minor] make parameter names for verify_* consistent * stubtest: gut error handling * stubtest: add support for missing things * stubtest: implement verify module * stubtest: add trace for easier debugging * stubtest: implement verify class * stubtest: implement verify missing * stubtest: implement verify function * stubtest: implement verify var * stubtest: logging improvements * stubtest: improve verify function * stubtest: implement verify overload * stubtest: more improvements to logging * stubtest: add --ignore-missing-stub option * stubtest: [minor] make order more deterministic * stubtest: [minor] descend through stubs less hackily * stubtest: [minor] clean up imports * stubtest: [minor] remove debugging decorator * stubtest: small improvements for functions * stubtest: add --concise option * stubtest: add exit code * stubtest: redo verify function Rework things to avoid false positives / order nitpicks Make checks involving *args, **kwargs a little more sophisticated * stubtest: add ability to whitelist errors * stubtest: [minor] clean up error handling * stubtest: add --check-typeshed option * stubtest: [minor] handle distutils.command a little better * stubtest: adjust module level things we check in stubs * stubtest: check for mistaken positional only args * stubtest: be more permissive about positional-only arg names * stubtest: [minor] make error order more deterministic * stubtest: only mypy build once This makes the script complete 100x faster when using --check-typeshed * stubtest: [minor] remove antigravity from --check-typeshed * stubtest: make verify_var work * stubtest: verify types of argument default values * stubtest: pretend Literal[0, 1] is subtype of bool * stubtest: output unused whitelist entries * stubtest: [minor] deduplicate, sort --output-whitelist, fix exit code * stubtest: add more documentation Also flatten out get_mypy_type_of_runtime_value * stubtest: [minor] rename --output-whitelist to --generate-whitelist * stubtest: [minor] suppress warnings * stubtest: look into the mro for attributes Prevents false positives when not using --ignore-missing-stub * stubtest: better support @Property and other decorators * stubtest: check classmethod and staticmethod * stubtest: [minor] support comments in whitelist * stubtest: [refactor] split up verify_funcitem * stubtest: [minor] suggest positional-only name The name doesn't matter, but if someone's fixing something, we might as well make it easy to match runtime name * stubtest: add __str__ for Signature * stubtest: implement smarter overload checking This eliminates ~400 false positives * stubtest: improve typeinfo output, simplify descriptions * stubtest: [minor] blacken Switched laptops, think I ran into a black version difference * stubtest: improve decorator handling, fix classmethod signature * stubtest: fix classmethod and staticmethod introspection This was just broken previously * stubtest: [minor] factor out is_dunder, check suffix * stubtest: fix proper_plugin, other selfcheck errors * stubtest: find submodules when explicitly testing a module * stubtest: remove f-strings for py35 * stubtest: remove variable annotations for py35 * stubtest: remove trailing commas for py35 * stubtest: other changes for py35 * stubtest: [minor] use line length 99 to match project * stubtest: add a flag to ignore positional-only errors * stubtest: check typevar upper bounds for default values is_subtype would always return False, leading to false positives most times TypeVars were used for parameters with default values. We still have some false positives from Unions of TypeVars, but that's less bad, and could almost all be fixed by adjusting the overload of Mapping.get * stubtest: don't crash because of bpo-39504 * stubtest: avoid false positive when defining enums * stubtest: allow multiple whitelists * stubtest: [minor] improve help message
1 parent 0c03690 commit 17b0a7a

File tree

1 file changed

+1015
-170
lines changed

1 file changed

+1015
-170
lines changed

0 commit comments

Comments
 (0)