-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Make FunctionDef.implicit_parameters
return 1 for methods
#1531
Changes from all commits
124f5bd
0540c55
0d200ae
0812abb
a2b8438
ad3d987
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 |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
|
||
@pytest.mark.skipif(HAS_PYQT6 is None, reason="This test requires the PyQt6 library.") | ||
class TestBrainQt: | ||
AstroidManager.brain["extension_package_whitelist"] = {"PyQt6"} | ||
|
||
@staticmethod | ||
def test_value_of_lambda_instance_attrs_is_list(): | ||
"""Regression test for https://github.com/PyCQA/pylint/issues/6221 | ||
|
@@ -28,11 +30,25 @@ def test_value_of_lambda_instance_attrs_is_list(): | |
from PyQt6 import QtPrintSupport as printsupport | ||
printsupport.QPrintPreviewDialog.paintRequested #@ | ||
""" | ||
AstroidManager.brain["extension_package_whitelist"] = {"PyQt6.QtPrintSupport"} | ||
node = extract_node(src) | ||
attribute_node = node.inferred()[0] | ||
if attribute_node is Uninferable: | ||
pytest.skip("PyQt6 C bindings may not be installed?") | ||
assert isinstance(attribute_node, UnboundMethod) | ||
# scoped_nodes.Lambda.instance_attrs is typed as Dict[str, List[NodeNG]] | ||
assert isinstance(attribute_node.instance_attrs["connect"][0], FunctionDef) | ||
|
||
@staticmethod | ||
def test_implicit_parameters() -> None: | ||
"""Regression test for https://github.com/PyCQA/pylint/issues/6464""" | ||
src = """ | ||
from PyQt6.QtCore import QTimer | ||
timer = QTimer() | ||
timer.timeout.connect #@ | ||
""" | ||
node = extract_node(src) | ||
attribute_node = node.inferred()[0] | ||
if attribute_node is Uninferable: | ||
pytest.skip("PyQt6 C bindings may not be installed?") | ||
Comment on lines
+51
to
+52
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. Don't we want to force the c binding to work correctly in at least one of the CI pipeline ? Otherwise this test can work fine online and fail for someone with QT locally. I think we could create a pytest mark for "qt" and a CI job with a proper installation. 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. Yes, it works in the "release tests" workflow. 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, it means we're going to catch issues at release time right ? When/how are we launching this workflow ? 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. Just manually with a reminder in the release.md. Installing 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. For 40s we might as well add it for each commit (one interpreter only ?). There's a lot of available runner for astroid and they run in a reasonable time (compared to pylint anyway). 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. Actually, it takes 8s, duh, because most of that linked run was setting up the env! 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 confused - why does "Install Qt" actually only do 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. We discovered that the |
||
assert isinstance(attribute_node, FunctionDef) | ||
assert attribute_node.implicit_parameters() == 1 |
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.
This method was untested according to coveralls.