Skip to content
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

Add regression test for #6895 #6898

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/whatsnew/2/2.14/full.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ What's New in Pylint 2.14.2?
----------------------------
Release date: TBA


* Fixed a false positive for ``unused-variable`` when a function returns an
``argparse.Namespace`` object.

Closes #6895

* Avoided raising an identical ``undefined-loop-variable`` message twice on the same line.

* Don't crash if ``lint.run._query_cpu()`` is run within a Kubernetes Pod, that has only
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 .[testutils,spelling]
# astroid dependency is also defined in setup.cfg
astroid==2.11.5 # Pinned to a specific version for tests
astroid==2.11.6 # Pinned to a specific version for tests
typing-extensions~=4.2
pytest~=7.1
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 @@ -47,7 +47,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.5,<=2.12.0-dev0
astroid>=2.11.6,<=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/unused/unused_variable_after_inference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Regression test for https://github.com/PyCQA/pylint/issues/6895"""
# pylint: disable=missing-class-docstring,too-few-public-methods
import argparse
class Cls:
def meth(self):
"""Enable non-iterator-returned to produce the failure condition"""
return argparse.Namespace(debug=True)
2 changes: 2 additions & 0 deletions tests/functional/u/unused/unused_variable_after_inference.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Messages Control]
enable=non-iterator-returned