-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Fix instance_attrs building error in Qt brain #1505
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9e0ac95
Fix instance_attrs building error in Qt brain
jacobtylerwalls 1431862
add skip
jacobtylerwalls c31a087
Move comment down
jacobtylerwalls 6aeeb8e
Add typing
jacobtylerwalls 7f6d70d
Create environment with Qt6 in release tests workflow
jacobtylerwalls 59ac867
Apply suggestions from code review
jacobtylerwalls de8ca67
Remove docstring typing
jacobtylerwalls d4bde30
Rename
jacobtylerwalls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,31 @@ jobs: | |
. venv2\scripts\activate | ||
echo "import distutils.util # pylint: disable=unused-import" > test.py | ||
pylint test.py | ||
|
||
additional-dependencies-linux-tests: | ||
name: Regression tests w/ additional dependencies (Linux) | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: Set up Python | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
- name: Install Qt | ||
run: | | ||
sudo apt-get install build-essential libgl1-mesa-dev | ||
- name: Create Python virtual environment | ||
run: | | ||
python -m venv venv | ||
. venv/bin/activate | ||
python -m pip install -U pip setuptools wheel | ||
pip install -U -r requirements_test.txt -r requirements_test_brain.txt | ||
pip install -e . | ||
- name: Run brain_qt tests | ||
# Regression test added in https://github.com/PyCQA/astroid/pull/1505 | ||
run: | | ||
. venv/bin/activate | ||
pytest tests/unittest_brain_qt.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ types-attrs | |
nose | ||
numpy>=1.17.0 | ||
python-dateutil | ||
PyQt6 | ||
types-python-dateutil | ||
six | ||
types-six |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html | ||
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE | ||
# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt | ||
|
||
from importlib.util import find_spec | ||
|
||
import pytest | ||
|
||
from astroid import Uninferable, extract_node | ||
from astroid.bases import UnboundMethod | ||
from astroid.manager import AstroidManager | ||
from astroid.nodes import FunctionDef | ||
|
||
HAS_PYQT6 = find_spec("PyQt6") | ||
|
||
|
||
@pytest.mark.skipif(HAS_PYQT6 is None, reason="This test requires the PyQt6 library.") | ||
jacobtylerwalls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
class TestBrainQt: | ||
@staticmethod | ||
def test_value_of_lambda_instance_attrs_is_list(): | ||
"""Regression test for https://github.com/PyCQA/pylint/issues/6221 | ||
|
||
A crash occurred in pylint when a nodes.FunctionDef was iterated directly, | ||
giving items like "self" instead of iterating a one-element list containing | ||
the wanted nodes.FunctionDef. | ||
""" | ||
src = """ | ||
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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As mentioned over in #1531 (comment):