-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Don't check plugin-generated functions #16524
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: master
Are you sure you want to change the base?
Changes from all commits
a9a83bb
0b7aee9
8a44796
6d92891
525280b
6447d48
33d06cc
8980c84
fcd3e0a
993ac57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1303,18 +1303,18 @@ def f(i: int, s): | |
main:3: error: Function is missing a return type annotation | ||
main:3: error: Function is missing a type annotation for one or more arguments | ||
|
||
[case testDisallowIncompleteDefsAttrsNoAnnotations] | ||
# flags: --disallow-incomplete-defs | ||
[case testDisallowUntypedDefsAttrsNoAnnotations] | ||
# flags: --disallow-untyped-defs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to also test with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a test for the attrs "regression". I didn't actually add a regression test for #16454, perhaps I should. I remember I tried at first, and it was made tricky due There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The easiest workaround might be to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about 33d06cc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I'm a little worried about it (see my comment). If there is no other way, it's fine to omit the test cases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I follow.
|
||
import attrs | ||
|
||
@attrs.define | ||
class Unannotated: | ||
foo = attrs.field() | ||
foo = attrs.field() # E: Need type annotation for "foo" | ||
|
||
[builtins fixtures/plugin_attrs.pyi] | ||
|
||
[case testDisallowIncompleteDefsAttrsWithAnnotations] | ||
# flags: --disallow-incomplete-defs | ||
[case testDisallowUntypedDefsAttrsWithAnnotations] | ||
# flags: --disallow-untyped-defs | ||
import attrs | ||
|
||
@attrs.define | ||
|
@@ -1323,14 +1323,14 @@ class Annotated: | |
|
||
[builtins fixtures/plugin_attrs.pyi] | ||
|
||
[case testDisallowIncompleteDefsAttrsPartialAnnotations] | ||
# flags: --disallow-incomplete-defs | ||
[case testDisallowUntypedDefsAttrsPartialAnnotations] | ||
# flags: --disallow-untyped-defs | ||
import attrs | ||
|
||
@attrs.define | ||
class PartiallyAnnotated: # E: Function is missing a type annotation for one or more arguments | ||
class PartiallyAnnotated: | ||
bar: int = attrs.field() | ||
baz = attrs.field() | ||
baz = attrs.field() # E: Need type annotation for "baz" | ||
|
||
[builtins fixtures/plugin_attrs.pyi] | ||
|
||
|
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.
I'd rather not do this if this can silence errors if test fixtures have issues. It would be better to either add a minimal custom fixture that is only used in the relevant test cases or to omit the test cases that need this (I trust that you've tested it already).
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.
_is_typeshed_file
does not silence all errors, though.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 premise of errors in fixtures becoming obscured concerned me too, but having the test environment closer to actual environment seemed more prudent.
If you feel particularly iffy about it, sure, I can add
# type:ignore[misc]
to a handful of places in the fixtures.