summaryrefslogtreecommitdiff
path: root/tests/functional/d/deprecated
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2022-03-11 07:15:35 -0500
committerGitHub <noreply@github.com>2022-03-11 13:15:35 +0100
commita6e02fb6f0dd2c84dc1bf58df0f2511fe9ab90c2 (patch)
treea2f2077c0145ce79e99bf41d0fc991e8f3452099 /tests/functional/d/deprecated
parent588ed30f267a77d16233256e5f832d32533b795d (diff)
downloadpylint-git-a6e02fb6f0dd2c84dc1bf58df0f2511fe9ab90c2.tar.gz
Prevent `useless-suppression` on disables for stdlib deprecation checker (#5876)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'tests/functional/d/deprecated')
-rw-r--r--tests/functional/d/deprecated/deprecated_method_suppression.py8
-rw-r--r--tests/functional/d/deprecated/deprecated_methods_py39.py4
-rw-r--r--tests/functional/d/deprecated/deprecated_methods_py39.rc2
-rw-r--r--tests/functional/d/deprecated/deprecated_methods_py39.txt1
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py3.txt2
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py39.py4
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py39.rc2
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py39.txt1
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.py6
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc5
-rw-r--r--tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.txt1
11 files changed, 35 insertions, 1 deletions
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