Closed mabrowning closed 3 years ago
The test_wellknowntypes passes, but the feature doesn't actually work
Yeah, that would be because TestWellKnownTypes
only instantiates the pylint_protobuf
checker, whereas the no-member
warnings are raised by the inbuilt pylint typecheck
checker. When testing the integration of components like this, I've resorted to writing end-to-end tests like the one in test_issue32.py
:
def test_membership_on_map_types(warnings_mod, linter_factory):
linter = linter_factory(
register=pylint_protobuf.register,
disable=['all'], enable=['unsupported-membership-test',
'unsubscriptable-object'],
)
linter.check([warnings_mod])
# expected_messages = [
# pylint.checkers.typecheck.MSGS['E1135'][0] % ('m.map_test',),
# pylint.checkers.typecheck.MSGS['E1136'][0] % ('m.map_test',),
# ]
actual_messages = [m.msg for m in linter.reporter.messages]
assert not actual_messages
The WKT test cases were written some time before I started handling these kinds of tests.
The
test_wellknowntypes
passes, but the feature doesn't actually work:Looks like nothing checks the
cls_def
for membership in the well known types with the new astroid refactor (which is otherwise great). This PR attempts to rectify that, though I feel like there should be a better way of finding the absolute name/module name a class is defined in...