diff --git a/doc/symilar.rst b/doc/symilar.rst
index 5b75ff38f2..fd7124e1db 100644
--- a/doc/symilar.rst
+++ b/doc/symilar.rst
@@ -20,7 +20,6 @@ All files that shall be checked have to be passed in explicitly, e.g.::
==tests/data/suppliermodule_test.py:12
class Ancestor:
""" Ancestor method """
- __implements__ = (Interface,)
cls_member = DoNothing()
def __init__(self, value):
diff --git a/doc/whatsnew/fragments/8404.breaking b/doc/whatsnew/fragments/8404.breaking
new file mode 100644
index 0000000000..09ae74adb3
--- /dev/null
+++ b/doc/whatsnew/fragments/8404.breaking
@@ -0,0 +1,11 @@
+Everything related to the ``__implements__`` construct was removed. It was based on PEP245
+that was proposed in 2001 and rejected in 2006. It includes all the classes inheriting
+``Interface`` in ``pylint.interfaces``
+
+``Checker`` should only inherit ``BaseChecker`` or any of the other checker types from ``pylint.checkers``.
+``Reporter`` should only inherit ``BaseReporter``.
+
+The capability from pyreverse to take ``__implements__`` into account when generating diagrams
+was also removed.
+
+Refs #8404
diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py
index d6172fb42a..b75cc6dbc6 100644
--- a/pylint/checkers/base_checker.py
+++ b/pylint/checkers/base_checker.py
@@ -6,7 +6,6 @@
import abc
import functools
-import warnings
from collections.abc import Iterable, Sequence
from inspect import cleandoc
from tokenize import TokenInfo
@@ -17,7 +16,7 @@
from pylint.config.arguments_provider import _ArgumentsProvider
from pylint.constants import _MSG_ORDER, MAIN_CHECKER_NAME, WarningScope
from pylint.exceptions import InvalidMessageError
-from pylint.interfaces import Confidence, IRawChecker, ITokenChecker, implements
+from pylint.interfaces import Confidence
from pylint.message.message_definition import MessageDefinition
from pylint.typing import (
ExtraMessageOptions,
@@ -47,18 +46,9 @@ class BaseChecker(_ArgumentsProvider):
def __init__(self, linter: PyLinter) -> None:
"""Checker instances should have the linter as argument."""
- if getattr(self, "__implements__", None):
- warnings.warn(
- "Using the __implements__ inheritance pattern for BaseChecker is no "
- "longer supported. Child classes should only inherit BaseChecker or any "
- "of the other checker types from pylint.checkers.",
- DeprecationWarning,
- stacklevel=2,
- )
if self.name is not None:
self.name = self.name.lower()
self.linter = linter
-
_ArgumentsProvider.__init__(self, linter)
def __gt__(self, other: Any) -> bool:
@@ -191,21 +181,10 @@ def check_consistency(self) -> None:
def create_message_definition_from_tuple(
self, msgid: str, msg_tuple: MessageDefinitionTuple
) -> MessageDefinition:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- if isinstance(self, (BaseTokenChecker, BaseRawFileChecker)):
- default_scope = WarningScope.LINE
- # TODO: 3.0: Remove deprecated if-statement
- elif implements(self, (IRawChecker, ITokenChecker)):
- warnings.warn( # pragma: no cover
- "Checkers should subclass BaseTokenChecker or BaseRawFileChecker "
- "instead of using the __implements__ mechanism. Use of __implements__ "
- "will no longer be supported in pylint 3.0",
- DeprecationWarning,
- )
- default_scope = WarningScope.LINE # pragma: no cover
- else:
- default_scope = WarningScope.NODE
+ if isinstance(self, (BaseTokenChecker, BaseRawFileChecker)):
+ default_scope = WarningScope.LINE
+ else:
+ default_scope = WarningScope.NODE
options: ExtraMessageOptions = {}
if len(msg_tuple) == 4:
(msg, symbol, descr, options) = msg_tuple # type: ignore[misc]
diff --git a/pylint/interfaces.py b/pylint/interfaces.py
index 221084fab2..eef2b728b8 100644
--- a/pylint/interfaces.py
+++ b/pylint/interfaces.py
@@ -2,27 +2,11 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-"""Interfaces for Pylint objects."""
-
from __future__ import annotations
-import warnings
-from tokenize import TokenInfo
-from typing import TYPE_CHECKING, NamedTuple
-
-from astroid import nodes
-
-if TYPE_CHECKING:
- from pylint.checkers import BaseChecker
- from pylint.message import Message
- from pylint.reporters.ureports.nodes import Section
+from typing import NamedTuple
__all__ = (
- "IRawChecker",
- "IAstroidChecker",
- "ITokenChecker",
- "IReporter",
- "IChecker",
"HIGH",
"CONTROL_FLOW",
"INFERENCE",
@@ -51,87 +35,3 @@ class Confidence(NamedTuple):
CONFIDENCE_LEVELS = [HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, UNDEFINED]
CONFIDENCE_LEVEL_NAMES = [i.name for i in CONFIDENCE_LEVELS]
-
-
-class Interface:
- """Base class for interfaces."""
-
- def __init__(self) -> None:
- warnings.warn(
- "Interface and all of its subclasses have been deprecated "
- "and will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
-
- @classmethod
- def is_implemented_by(
- cls: type[Interface] | tuple[type[Interface], ...], instance: BaseChecker
- ) -> bool:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- return implements(instance, cls)
-
-
-def implements(
- obj: BaseChecker,
- interface: type[Interface] | tuple[type[Interface], ...],
-) -> bool:
- """Does the given object (maybe an instance or class) implement the interface."""
- # TODO: 3.0: Remove deprecated function
- warnings.warn(
- "implements has been deprecated in favour of using basic "
- "inheritance patterns without using __implements__.",
- DeprecationWarning,
- stacklevel=2,
- )
- implements_ = getattr(obj, "__implements__", ())
- if not isinstance(implements_, (list, tuple)):
- implements_ = (implements_,)
- return any(issubclass(i, interface) for i in implements_)
-
-
-class IChecker(Interface):
- """Base interface, to be used only for sub interfaces definition."""
-
- def open(self) -> None:
- """Called before visiting project (i.e. set of modules)."""
-
- def close(self) -> None:
- """Called after visiting project (i.e. set of modules)."""
-
-
-class IRawChecker(IChecker):
- """Interface for checker which need to parse the raw file."""
-
- def process_module(self, node: nodes.Module) -> None:
- """Process a module.
-
- The module's content is accessible via ``astroid.stream``
- """
-
-
-class ITokenChecker(IChecker):
- """Interface for checkers that need access to the token list."""
-
- def process_tokens(self, tokens: list[TokenInfo]) -> None:
- """Process a module.
-
- Tokens is a list of all source code tokens in the file.
- """
-
-
-class IAstroidChecker(IChecker):
- """Interface for checker which prefers receive events according to
- statement type.
- """
-
-
-class IReporter(Interface):
- """Reporter collect messages and display results encapsulated in a layout."""
-
- def handle_message(self, msg: Message) -> None:
- """Handle the given message object."""
-
- def display_reports(self, layout: Section) -> None:
- """Display results encapsulated in the layout tree."""
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py
index b35867eae8..143ad5c085 100644
--- a/pylint/lint/pylinter.py
+++ b/pylint/lint/pylinter.py
@@ -957,41 +957,9 @@ def _astroid_module_checker(
tokencheckers = [
c for c in _checkers if isinstance(c, checkers.BaseTokenChecker)
]
- # TODO: 3.0: Remove deprecated for-loop
- for c in _checkers:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- if (
- interfaces.implements(c, interfaces.ITokenChecker)
- and c not in tokencheckers
- and c is not self
- ):
- tokencheckers.append(c) # type: ignore[arg-type] # pragma: no cover
- warnings.warn( # pragma: no cover
- "Checkers should subclass BaseTokenChecker "
- "instead of using the __implements__ mechanism. Use of __implements__ "
- "will no longer be supported in pylint 3.0",
- DeprecationWarning,
- )
rawcheckers = [
c for c in _checkers if isinstance(c, checkers.BaseRawFileChecker)
]
- # TODO: 3.0: Remove deprecated if-statement
- for c in _checkers:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- if (
- interfaces.implements(c, interfaces.IRawChecker)
- and c not in rawcheckers
- ):
- rawcheckers.append(c) # type: ignore[arg-type] # pragma: no cover
- warnings.warn( # pragma: no cover
- "Checkers should subclass BaseRawFileChecker "
- "instead of using the __implements__ mechanism. Use of __implements__ "
- "will no longer be supported in pylint 3.0",
- DeprecationWarning,
- )
- # notify global begin
for checker in _checkers:
checker.open()
walker.add_checker(checker)
diff --git a/pylint/pyreverse/diagrams.py b/pylint/pyreverse/diagrams.py
index 4437d3c4e0..54b138752b 100644
--- a/pylint/pyreverse/diagrams.py
+++ b/pylint/pyreverse/diagrams.py
@@ -207,13 +207,6 @@ def extract_relationships(self) -> None:
self.add_relationship(obj, par_obj, "specialization")
except KeyError:
continue
- # implements link
- for impl_node in node.implements:
- try:
- impl_obj = self.object_from_node(impl_node)
- self.add_relationship(obj, impl_obj, "implements")
- except KeyError:
- continue
# associations & aggregations links
for name, values in list(node.aggregations_type.items()):
diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py
index 523ff81716..aa52845b49 100644
--- a/pylint/pyreverse/inspector.py
+++ b/pylint/pyreverse/inspector.py
@@ -12,13 +12,11 @@
import collections
import os
import traceback
-import warnings
from abc import ABC, abstractmethod
-from collections.abc import Generator
-from typing import Any, Callable, Optional
+from typing import Callable, Optional
import astroid
-from astroid import nodes, util
+from astroid import nodes
from pylint import constants
from pylint.pyreverse import utils
@@ -39,27 +37,6 @@ def _astroid_wrapper(
return None
-def interfaces(node: nodes.ClassDef) -> Generator[Any, None, None]:
- """Return an iterator on interfaces implemented by the given class node."""
- try:
- implements = astroid.bases.Instance(node).getattr("__implements__")[0]
- except astroid.exceptions.NotFoundError:
- return
- if implements.frame(future=True) is not node:
- return
- found = set()
- missing = False
- for iface in nodes.unpack_infer(implements):
- if isinstance(iface, util.UninferableBase):
- missing = True
- continue
- if iface not in found:
- found.add(iface)
- yield iface
- if missing:
- raise astroid.exceptions.InferenceError()
-
-
class IdGeneratorMixIn:
"""Mixin adding the ability to generate integer uid."""
@@ -194,24 +171,6 @@ def visit_classdef(self, node: nodes.ClassDef) -> None:
if not isinstance(assignattr, nodes.Unknown):
self.associations_handler.handle(assignattr, node)
self.handle_assignattr_type(assignattr, node)
- # resolve implemented interface
- try:
- ifaces = interfaces(node)
- if ifaces is not None:
- node.implements = list(ifaces)
- if node.implements:
- # TODO: 3.0: Remove support for __implements__
- warnings.warn(
- "pyreverse will drop support for resolving and displaying "
- "implemented interfaces in pylint 3.0. The implementation "
- "relies on the '__implements__' attribute proposed in PEP 245"
- ", which was rejected in 2006.",
- DeprecationWarning,
- )
- else:
- node.implements = []
- except astroid.InferenceError:
- node.implements = []
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
"""Visit an astroid.Function node.
diff --git a/pylint/reporters/base_reporter.py b/pylint/reporters/base_reporter.py
index 3df970d80b..5d42407234 100644
--- a/pylint/reporters/base_reporter.py
+++ b/pylint/reporters/base_reporter.py
@@ -6,7 +6,6 @@
import os
import sys
-import warnings
from typing import TYPE_CHECKING, TextIO
from warnings import warn
@@ -31,13 +30,6 @@ class BaseReporter:
"""Name of the reporter."""
def __init__(self, output: TextIO | None = None) -> None:
- if getattr(self, "__implements__", None):
- warnings.warn(
- "Using the __implements__ inheritance pattern for BaseReporter is no "
- "longer supported. Child classes should only inherit BaseReporter",
- DeprecationWarning,
- stacklevel=2,
- )
self.linter: PyLinter
self.section = 0
self.out: TextIO = output or sys.stdout
diff --git a/tests/data/clientmodule_test.py b/tests/data/clientmodule_test.py
index 35c39684b5..7f7c83f46d 100644
--- a/tests/data/clientmodule_test.py
+++ b/tests/data/clientmodule_test.py
@@ -3,7 +3,6 @@
class Ancestor:
""" Ancestor method """
- __implements__ = (Interface,)
cls_member = DoNothing()
def __init__(self, value):
diff --git a/tests/pyreverse/data/classes_No_Name.dot b/tests/pyreverse/data/classes_No_Name.dot
index a598ab6d9a..684f4fe68e 100644
--- a/tests/pyreverse/data/classes_No_Name.dot
+++ b/tests/pyreverse/data/classes_No_Name.dot
@@ -10,7 +10,6 @@ charset="utf-8"
"data.property_pattern.PropertyPatterns" [color="black", fontcolor="black", label=<{PropertyPatterns|prop1
prop2
|}>, shape="record", style="solid"];
"data.clientmodule_test.Specialization" [color="black", fontcolor="black", label=<{Specialization|TYPE : str
relation
relation2
top : str
|from_value(value: int)
increment_value(): None
transform_value(value: int): int
}>, shape="record", style="solid"];
"data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"];
-"data.clientmodule_test.Ancestor" -> "data.suppliermodule_test.Interface" [arrowhead="empty", arrowtail="node", style="dashed"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"];
"data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"];
diff --git a/tests/pyreverse/data/classes_No_Name.html b/tests/pyreverse/data/classes_No_Name.html
index 602f2e3b7a..08bac00341 100644
--- a/tests/pyreverse/data/classes_No_Name.html
+++ b/tests/pyreverse/data/classes_No_Name.html
@@ -40,7 +40,6 @@
transform_value(value: int) int
}
Specialization --|> Ancestor
- Ancestor ..|> Interface
DoNothing --* Ancestor : cls_member
DoNothing --* Specialization : relation
DoNothing2 --o Specialization : relation2
diff --git a/tests/pyreverse/data/classes_No_Name.mmd b/tests/pyreverse/data/classes_No_Name.mmd
index 1db88b2ae8..7ad6f14230 100644
--- a/tests/pyreverse/data/classes_No_Name.mmd
+++ b/tests/pyreverse/data/classes_No_Name.mmd
@@ -35,7 +35,6 @@ classDiagram
transform_value(value: int) int
}
Specialization --|> Ancestor
- Ancestor ..|> Interface
DoNothing --* Ancestor : cls_member
DoNothing --* Specialization : relation
DoNothing2 --o Specialization : relation2
diff --git a/tests/pyreverse/data/classes_No_Name.puml b/tests/pyreverse/data/classes_No_Name.puml
index 837e6865c3..ee5fb124a1 100644
--- a/tests/pyreverse/data/classes_No_Name.puml
+++ b/tests/pyreverse/data/classes_No_Name.puml
@@ -36,7 +36,6 @@ class "Specialization" as data.clientmodule_test.Specialization {
transform_value(value: int) -> int
}
data.clientmodule_test.Specialization --|> data.clientmodule_test.Ancestor
-data.clientmodule_test.Ancestor ..|> data.suppliermodule_test.Interface
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Ancestor : cls_member
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Specialization : relation
data.suppliermodule_test.DoNothing2 --o data.clientmodule_test.Specialization : relation2
diff --git a/tests/pyreverse/data/classes_No_Name.vcg b/tests/pyreverse/data/classes_No_Name.vcg
index 4c792db698..2df09a2dc0 100644
--- a/tests/pyreverse/data/classes_No_Name.vcg
+++ b/tests/pyreverse/data/classes_No_Name.vcg
@@ -31,11 +31,6 @@ graph:{
edge: {sourcename:"data.clientmodule_test.Specialization" targetname:"data.clientmodule_test.Ancestor" arrowstyle:solid
backarrowstyle:none
backarrowsize:10
-}
- edge: {sourcename:"data.clientmodule_test.Ancestor" targetname:"data.suppliermodule_test.Interface" arrowstyle:solid
- backarrowstyle:none
- linestyle:dotted
- backarrowsize:10
}
edge: {sourcename:"data.suppliermodule_test.DoNothing" targetname:"data.clientmodule_test.Ancestor" arrowstyle:solid
backarrowstyle:none
diff --git a/tests/pyreverse/data/classes_colorized.dot b/tests/pyreverse/data/classes_colorized.dot
index 4ff12a8191..3ea2d83959 100644
--- a/tests/pyreverse/data/classes_colorized.dot
+++ b/tests/pyreverse/data/classes_colorized.dot
@@ -10,7 +10,6 @@ charset="utf-8"
"data.property_pattern.PropertyPatterns" [color="aliceblue", fontcolor="black", label=<{PropertyPatterns|prop1
prop2
|}>, shape="record", style="filled"];
"data.clientmodule_test.Specialization" [color="aliceblue", fontcolor="black", label=<{Specialization|TYPE : str
relation
relation2
top : str
|from_value(value: int)
increment_value(): None
transform_value(value: int): int
}>, shape="record", style="filled"];
"data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"];
-"data.clientmodule_test.Ancestor" -> "data.suppliermodule_test.Interface" [arrowhead="empty", arrowtail="node", style="dashed"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"];
"data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"];
diff --git a/tests/pyreverse/data/classes_colorized.puml b/tests/pyreverse/data/classes_colorized.puml
index 7398ee60f6..d96ee3e4f8 100644
--- a/tests/pyreverse/data/classes_colorized.puml
+++ b/tests/pyreverse/data/classes_colorized.puml
@@ -36,7 +36,6 @@ class "Specialization" as data.clientmodule_test.Specialization #aliceblue {
transform_value(value: int) -> int
}
data.clientmodule_test.Specialization --|> data.clientmodule_test.Ancestor
-data.clientmodule_test.Ancestor ..|> data.suppliermodule_test.Interface
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Ancestor : cls_member
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Specialization : relation
data.suppliermodule_test.DoNothing2 --o data.clientmodule_test.Specialization : relation2
diff --git a/tests/pyreverse/test_diadefs.py b/tests/pyreverse/test_diadefs.py
index da16eea333..5dba9466d5 100644
--- a/tests/pyreverse/test_diadefs.py
+++ b/tests/pyreverse/test_diadefs.py
@@ -102,14 +102,12 @@ class TestDefaultDiadefGenerator:
("aggregation", "DoNothing2", "Specialization"),
("association", "DoNothing", "Ancestor"),
("association", "DoNothing", "Specialization"),
- ("implements", "Ancestor", "Interface"),
("specialization", "Specialization", "Ancestor"),
]
def test_extract_relations(self, HANDLER: DiadefsHandler, PROJECT: Project) -> None:
"""Test extract_relations between classes."""
- with pytest.warns(DeprecationWarning):
- cd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)[1]
+ cd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)[1]
cd.extract_relationships()
relations = _process_relations(cd.relationships)
assert relations == self._should_rels
diff --git a/tests/pyreverse/test_inspector.py b/tests/pyreverse/test_inspector.py
index 00cad918f6..77afb947f0 100644
--- a/tests/pyreverse/test_inspector.py
+++ b/tests/pyreverse/test_inspector.py
@@ -15,7 +15,6 @@
import astroid
import pytest
-from astroid import nodes
from pylint.pyreverse import inspector
from pylint.pyreverse.inspector import Project
@@ -37,20 +36,6 @@ def project(get_project: GetProjectCallable) -> Generator[Project, None, None]:
yield project
-def test_class_implements(project: Project) -> None:
- klass = project.get_module("data.clientmodule_test")["Ancestor"]
- assert hasattr(klass, "implements")
- assert len(klass.implements) == 1
- assert isinstance(klass.implements[0], nodes.ClassDef)
- assert klass.implements[0].name == "Interface"
-
-
-def test_class_implements_specialization(project: Project) -> None:
- klass = project.get_module("data.clientmodule_test")["Specialization"]
- assert hasattr(klass, "implements")
- assert len(klass.implements) == 0
-
-
def test_locals_assignment_resolution(project: Project) -> None:
klass = project.get_module("data.clientmodule_test")["Specialization"]
assert hasattr(klass, "locals_type")
@@ -78,54 +63,6 @@ def test_instance_attrs_resolution(project: Project) -> None:
assert type_dict["_id"][0] is astroid.Uninferable
-def test_concat_interfaces() -> None:
- cls = astroid.extract_node(
- '''
- class IMachin: pass
-
- class Correct2:
- """docstring"""
- __implements__ = (IMachin,)
-
- class BadArgument:
- """docstring"""
- __implements__ = (IMachin,)
-
- class InterfaceCanNowBeFound: #@
- """docstring"""
- __implements__ = BadArgument.__implements__ + Correct2.__implements__
- '''
- )
- interfaces = inspector.interfaces(cls)
- assert [i.name for i in interfaces] == ["IMachin"]
-
-
-def test_interfaces() -> None:
- module = astroid.parse(
- """
- class Interface(object): pass
- class MyIFace(Interface): pass
- class AnotherIFace(Interface): pass
- class Concrete0(object):
- __implements__ = MyIFace
- class Concrete1:
- __implements__ = (MyIFace, AnotherIFace)
- class Concrete2:
- __implements__ = (MyIFace, AnotherIFace)
- class Concrete23(Concrete1): pass
- """
- )
-
- for klass, interfaces in (
- ("Concrete0", ["MyIFace"]),
- ("Concrete1", ["MyIFace", "AnotherIFace"]),
- ("Concrete2", ["MyIFace", "AnotherIFace"]),
- ("Concrete23", []),
- ):
- klass = module[klass]
- assert [i.name for i in inspector.interfaces(klass)] == interfaces
-
-
def test_from_directory(project: Project) -> None:
expected = os.path.join("tests", "data", "__init__.py")
assert project.name == "data"
@@ -140,18 +77,3 @@ def test_project_node(project: Project) -> None:
"data.suppliermodule_test",
]
assert sorted(project.keys()) == expected
-
-
-def test_interface_deprecation(project: Project) -> None:
- linker = inspector.Linker(project)
- cls = astroid.extract_node(
- '''
- class IMachin: pass
-
- class Concrete: #@
- """docstring"""
- __implements__ = (IMachin,)
- '''
- )
- with pytest.warns(DeprecationWarning):
- linker.visit_classdef(cls)
diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
index 01666ba917..07502bc7ff 100644
--- a/tests/test_deprecation.py
+++ b/tests/test_deprecation.py
@@ -12,20 +12,9 @@
from astroid import nodes
from pylint import lint
-from pylint.checkers import BaseChecker
from pylint.checkers.mapreduce_checker import MapReduceMixin
-from pylint.interfaces import (
- IAstroidChecker,
- IChecker,
- Interface,
- IRawChecker,
- IReporter,
- ITokenChecker,
-)
from pylint.lint import PyLinter
from pylint.message import MessageDefinitionStore
-from pylint.reporters import BaseReporter
-from pylint.reporters.ureports.nodes import Section
from pylint.utils import FileState
@@ -43,45 +32,6 @@ def reduce_map_data(self, linter: PyLinter, data: list[Any]) -> None:
MyChecker()
-def test_reporter_implements() -> None:
- """Test that __implements__ on BaseReporter has been deprecated correctly."""
-
- class MyReporter(BaseReporter):
- __implements__ = IReporter
-
- def _display(self, layout: Section) -> None:
- ...
-
- with pytest.warns(DeprecationWarning):
- MyReporter()
-
-
-def test_checker_implements() -> None:
- """Test that __implements__ on BaseChecker has been deprecated correctly."""
-
- class MyChecker(BaseChecker):
- __implements__ = IAstroidChecker
-
- with pytest.warns(DeprecationWarning):
- MyChecker(PyLinter())
-
-
-def test_interfaces() -> None:
- """Test that all interfaces have been deprecated correctly."""
- with pytest.warns(DeprecationWarning):
- Interface()
- with pytest.warns(DeprecationWarning):
- IAstroidChecker()
- with pytest.warns(DeprecationWarning):
- IReporter()
- with pytest.warns(DeprecationWarning):
- IRawChecker()
- with pytest.warns(DeprecationWarning):
- IChecker()
- with pytest.warns(DeprecationWarning):
- ITokenChecker()
-
-
def test_filestate() -> None:
"""Test that FileState needs its arguments."""
with pytest.warns(DeprecationWarning):
diff --git a/tests/test_self.py b/tests/test_self.py
index e40dd7a4d1..a4c928e5c5 100644
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -257,9 +257,9 @@ def test_enable_all_works(self) -> None:
expected = textwrap.dedent(
f"""
************* Module data.clientmodule_test
- {module}:10:8: W0612: Unused variable 'local_variable' (unused-variable)
- {module}:18:4: C0116: Missing function or method docstring (missing-function-docstring)
- {module}:22:0: C0115: Missing class docstring (missing-class-docstring)
+ {module}:9:8: W0612: Unused variable 'local_variable' (unused-variable)
+ {module}:17:4: C0116: Missing function or method docstring (missing-function-docstring)
+ {module}:21:0: C0115: Missing class docstring (missing-class-docstring)
"""
)
self._test_output(