From a6e02fb6f0dd2c84dc1bf58df0f2511fe9ab90c2 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Fri, 11 Mar 2022 07:15:35 -0500 Subject: Prevent `useless-suppression` on disables for stdlib deprecation checker (#5876) Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> --- tests/functional/d/deprecated/deprecated_method_suppression.py | 8 ++++++++ tests/functional/d/deprecated/deprecated_methods_py39.py | 4 ++++ tests/functional/d/deprecated/deprecated_methods_py39.rc | 2 ++ tests/functional/d/deprecated/deprecated_methods_py39.txt | 1 + tests/functional/d/deprecated/deprecated_module_py3.txt | 2 +- tests/functional/d/deprecated/deprecated_module_py39.py | 4 ++++ tests/functional/d/deprecated/deprecated_module_py39.rc | 2 ++ tests/functional/d/deprecated/deprecated_module_py39.txt | 1 + .../d/deprecated/deprecated_module_py39_earlier_pyversion.py | 6 ++++++ .../d/deprecated/deprecated_module_py39_earlier_pyversion.rc | 5 +++++ .../d/deprecated/deprecated_module_py39_earlier_pyversion.txt | 1 + 11 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/functional/d/deprecated/deprecated_method_suppression.py create mode 100644 tests/functional/d/deprecated/deprecated_methods_py39.py create mode 100644 tests/functional/d/deprecated/deprecated_methods_py39.rc create mode 100644 tests/functional/d/deprecated/deprecated_methods_py39.txt create mode 100644 tests/functional/d/deprecated/deprecated_module_py39.py create mode 100644 tests/functional/d/deprecated/deprecated_module_py39.rc create mode 100644 tests/functional/d/deprecated/deprecated_module_py39.txt create mode 100644 tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.py create mode 100644 tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc create mode 100644 tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.txt (limited to 'tests/functional/d/deprecated') diff --git a/tests/functional/d/deprecated/deprecated_method_suppression.py b/tests/functional/d/deprecated/deprecated_method_suppression.py new file mode 100644 index 000000000..4f3bb63fe --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_method_suppression.py @@ -0,0 +1,8 @@ +"""Test that versions below Py3.10 will not emit useless-suppression for +disabling deprecated-method (on a method deprecated in Py3.10. + +This test can be run on all Python versions, but it will lack value when +Pylint drops support for 3.9.""" +# pylint: disable=import-error, unused-import + +import threading.current_thread # pylint: disable=deprecated-method diff --git a/tests/functional/d/deprecated/deprecated_methods_py39.py b/tests/functional/d/deprecated/deprecated_methods_py39.py new file mode 100644 index 000000000..9959b1c2a --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_methods_py39.py @@ -0,0 +1,4 @@ +"""Test deprecated methods from Python 3.9.""" + +import binascii +binascii.b2a_hqx() # [deprecated-method] diff --git a/tests/functional/d/deprecated/deprecated_methods_py39.rc b/tests/functional/d/deprecated/deprecated_methods_py39.rc new file mode 100644 index 000000000..16b75eea7 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_methods_py39.rc @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.9 diff --git a/tests/functional/d/deprecated/deprecated_methods_py39.txt b/tests/functional/d/deprecated/deprecated_methods_py39.txt new file mode 100644 index 000000000..292ca5ef1 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_methods_py39.txt @@ -0,0 +1 @@ +deprecated-method:4:0:4:18::Using deprecated method b2a_hqx():UNDEFINED diff --git a/tests/functional/d/deprecated/deprecated_module_py3.txt b/tests/functional/d/deprecated/deprecated_module_py3.txt index 79c0a418c..bf41f781e 100644 --- a/tests/functional/d/deprecated/deprecated_module_py3.txt +++ b/tests/functional/d/deprecated/deprecated_module_py3.txt @@ -1 +1 @@ -deprecated-module:4:::Uses of a deprecated module 'optparse' +deprecated-module:4:0:4:15::Uses of a deprecated module 'optparse':UNDEFINED diff --git a/tests/functional/d/deprecated/deprecated_module_py39.py b/tests/functional/d/deprecated/deprecated_module_py39.py new file mode 100644 index 000000000..a897dd4e3 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py39.py @@ -0,0 +1,4 @@ +"""Test deprecated modules from Python 3.9.""" +# pylint: disable=unused-import + +import binhex # [deprecated-module] diff --git a/tests/functional/d/deprecated/deprecated_module_py39.rc b/tests/functional/d/deprecated/deprecated_module_py39.rc new file mode 100644 index 000000000..16b75eea7 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py39.rc @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.9 diff --git a/tests/functional/d/deprecated/deprecated_module_py39.txt b/tests/functional/d/deprecated/deprecated_module_py39.txt new file mode 100644 index 000000000..c85cbcbff --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py39.txt @@ -0,0 +1 @@ +deprecated-module:4:0:4:13::Uses of a deprecated module 'binhex':UNDEFINED diff --git a/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.py b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.py new file mode 100644 index 000000000..c1c2f1788 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.py @@ -0,0 +1,6 @@ +"""Test deprecated modules from Python 3.9, +but use an earlier --py-version and ensure a warning is still emitted. +""" +# pylint: disable=unused-import + +import binhex # [deprecated-module] diff --git a/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc new file mode 100644 index 000000000..8118783a1 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc @@ -0,0 +1,5 @@ +[master] +py-version=3.8 + +[testoptions] +min_pyver=3.9 diff --git a/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.txt b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.txt new file mode 100644 index 000000000..558ed224a --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.txt @@ -0,0 +1 @@ +deprecated-module:6:0:6:13::Uses of a deprecated module 'binhex':UNDEFINED -- cgit v1.2.1