Skip to content

Commit

Permalink
Add regression test for #5982 upgrade astroid to 2.11.2 (#5988)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
jacobtylerwalls and Pierre-Sassoulas committed Mar 27, 2022
1 parent 6270d82 commit 6279ab1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ What's New in Pylint 2.13.2?
============================
Release date: TBA

* Fix crash when subclassing a ``namedtuple``.

Closes #5982

* Fix false positive for ``superfluous-parens`` for patterns like
"return (a or b) in iterable".

Expand Down
2 changes: 1 addition & 1 deletion requirements_test_min.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-e .[testutil]
# astroid dependency is also defined in setup.cfg
astroid==2.11.0 # Pinned to a specific version for tests
astroid==2.11.2 # Pinned to a specific version for tests
typing-extensions~=4.1
pytest~=7.0
pytest-benchmark~=3.4
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ install_requires =
# Also upgrade requirements_test_min.txt if you are bumping astroid.
# Pinned to dev of next minor update to allow editable installs,
# see https://github.com/PyCQA/astroid/issues/1341
astroid>=2.11.0,<=2.12.0-dev0
astroid>=2.11.2,<=2.12.0-dev0
isort>=4.2.5,<6
mccabe>=0.6,<0.8
tomli>=1.1.0;python_version<"3.11"
Expand Down
7 changes: 7 additions & 0 deletions tests/functional/u/used/used_before_assignment_py37.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for used-before-assignment with functions added in python 3.7"""
# pylint: disable=missing-function-docstring
from __future__ import annotations
from collections import namedtuple
from typing import List


Expand All @@ -26,3 +27,9 @@ def inner_method(self, other: MyClass) -> bool:
return self == other

return inner_method(self, MyClass())


class NamedTupleSubclass(namedtuple("NamedTupleSubclass", [])):
"""Taken from https://github.com/PyCQA/pylint/issues/5982"""
def method(self) -> NamedTupleSubclass:
"""Variables checker crashed when astroid did not supply a lineno"""
2 changes: 1 addition & 1 deletion tests/functional/u/used/used_before_assignment_py37.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
undefined-variable:17:20:17:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED
undefined-variable:18:20:18:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED

0 comments on commit 6279ab1

Please sign in to comment.