diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2022-06-13 11:38:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 17:38:21 +0200 |
commit | 258a5e96cceadfb80a96f54d6c7d83327d048eab (patch) | |
tree | eaa556369d3fb2ab650970b63c69c4585171e3a8 | |
parent | b524db8311cc0d622ddedc75b19c37fbbe14e535 (diff) | |
download | pylint-git-258a5e96cceadfb80a96f54d6c7d83327d048eab.tar.gz |
Add regression test for #6895 (#6898)
* Upgrade astroid to 2.11.6
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r-- | doc/whatsnew/2/2.14/full.rst | 6 | ||||
-rw-r--r-- | requirements_test_min.txt | 2 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | tests/functional/u/unused/unused_variable_after_inference.py | 7 | ||||
-rw-r--r-- | tests/functional/u/unused/unused_variable_after_inference.rc | 2 |
5 files changed, 17 insertions, 2 deletions
diff --git a/doc/whatsnew/2/2.14/full.rst b/doc/whatsnew/2/2.14/full.rst index 40ba3a4b1..9404bab0a 100644 --- a/doc/whatsnew/2/2.14/full.rst +++ b/doc/whatsnew/2/2.14/full.rst @@ -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 diff --git a/requirements_test_min.txt b/requirements_test_min.txt index 9b0d00ac8..386f2605c 100644 --- a/requirements_test_min.txt +++ b/requirements_test_min.txt @@ -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 @@ -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" diff --git a/tests/functional/u/unused/unused_variable_after_inference.py b/tests/functional/u/unused/unused_variable_after_inference.py new file mode 100644 index 000000000..569564dc9 --- /dev/null +++ b/tests/functional/u/unused/unused_variable_after_inference.py @@ -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) diff --git a/tests/functional/u/unused/unused_variable_after_inference.rc b/tests/functional/u/unused/unused_variable_after_inference.rc new file mode 100644 index 000000000..c3b20ca24 --- /dev/null +++ b/tests/functional/u/unused/unused_variable_after_inference.rc @@ -0,0 +1,2 @@ +[Messages Control] +enable=non-iterator-returned |