summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pylint/checkers/deprecated.py1
-rw-r--r--pylint/checkers/stdlib.py2
-rw-r--r--tests/checkers/unittest_deprecated.py24
3 files changed, 27 insertions, 0 deletions
diff --git a/pylint/checkers/deprecated.py b/pylint/checkers/deprecated.py
index 38ba5d546..3279951cd 100644
--- a/pylint/checkers/deprecated.py
+++ b/pylint/checkers/deprecated.py
@@ -13,6 +13,7 @@ ACCEPTABLE_NODES = (
astroid.BoundMethod,
astroid.UnboundMethod,
astroid.FunctionDef,
+ astroid.ClassDef,
)
diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py
index 7b60a9a10..44fb071ee 100644
--- a/pylint/checkers/stdlib.py
+++ b/pylint/checkers/stdlib.py
@@ -63,6 +63,8 @@ DEPRECATED_ARGUMENTS = {
"asyncio.subprocess.create_subprocess_shell": ((4, "loop"),),
"gettext.translation": ((5, "codeset"),),
"gettext.install": ((2, "codeset"),),
+ "functools.partialmethod": ((None, "func"),),
+ "weakref.finalize": ((None, "func"), (None, "obj")),
"profile.Profile.runcall": ((None, "func"),),
"cProfile.Profile.runcall": ((None, "func"),),
"bdb.Bdb.runcall": ((None, "func"),),
diff --git a/tests/checkers/unittest_deprecated.py b/tests/checkers/unittest_deprecated.py
index f9b45cd6d..a15596abc 100644
--- a/tests/checkers/unittest_deprecated.py
+++ b/tests/checkers/unittest_deprecated.py
@@ -34,6 +34,9 @@ class _DeprecatedChecker(DeprecatedMixin, BaseChecker):
if method == ".MyClass.mymethod3":
# def mymethod1(self, arg1, *, deprecated_arg1=None)
return ((None, "deprecated_arg1"),)
+ if method == ".MyClass":
+ # def __init__(self, deprecated_arg=None)
+ return ((0, "deprecated_arg"),)
return ()
@@ -359,6 +362,27 @@ class TestDeprecatedChecker(CheckerTestCase):
):
self.checker.visit_call(node)
+ def test_class_deprecated_arguments(self):
+
+ node = astroid.extract_node(
+ """
+ class MyClass:
+ def __init__(self, deprecated_arg=None):
+ pass
+
+ MyClass(5)
+ """
+ )
+ with self.assertAddsMessages(
+ Message(
+ msg_id="deprecated-argument",
+ args=("deprecated_arg", "MyClass"),
+ node=node,
+ confidence=UNDEFINED,
+ )
+ ):
+ self.checker.visit_call(node)
+
def test_deprecated_module(self):
# Tests detecting deprecated module
node = astroid.extract_node(