Skip to content

Commit 1a66274

Browse files
[deprecation] end_line and end_col_offset required in functional tests (#8466)
1 parent a479303 commit 1a66274

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

doc/whatsnew/fragments/8464.user_action renamed to doc/whatsnew/fragments/8465.user_action

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Following a deprecation period, it's no longer possible to use ``MASTER``
22
or ``master`` as configuration section in ``setup.cfg`` or ``tox.ini``. It's bad practice
33
to not start sections titles with the tool name. Please use ``pylint.main`` instead.
44

5-
Refs #8464
5+
Refs #8465

doc/whatsnew/fragments/8466.internal

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Following a deprecation period, ``MessageTest``'s ``end_line`` and ``end_col_offset``
2+
must be accurate in functional tests (for python 3.8 or above on cpython, and for
3+
python 3.9 or superior on pypy).
4+
5+
Refs #8466

pylint/testutils/checker_test_case.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from __future__ import annotations
66

77
import contextlib
8-
import warnings
98
from collections.abc import Generator, Iterator
109
from typing import Any
1110

@@ -78,23 +77,8 @@ def assertAddsMessages(
7877
assert expected_msg.line == gotten_msg.line, msg
7978
assert expected_msg.col_offset == gotten_msg.col_offset, msg
8079
if PY38_PLUS and not IS_PYPY or PY39_PLUS:
81-
# TODO: 3.0: Remove deprecated missing arguments and remove the warning
82-
if not expected_msg.end_line == gotten_msg.end_line:
83-
warnings.warn( # pragma: no cover
84-
f"The end_line attribute of {gotten_msg} does not match "
85-
f"the expected value in {expected_msg}. In pylint 3.0 correct end_line "
86-
"attributes will be required for MessageTest.",
87-
DeprecationWarning,
88-
stacklevel=2,
89-
)
90-
if not expected_msg.end_col_offset == gotten_msg.end_col_offset:
91-
warnings.warn( # pragma: no cover
92-
f"The end_col_offset attribute of {gotten_msg} does not match "
93-
f"the expected value in {expected_msg}. In pylint 3.0 correct end_col_offset "
94-
"attributes will be required for MessageTest.",
95-
DeprecationWarning,
96-
stacklevel=2,
97-
)
80+
assert expected_msg.end_line == gotten_msg.end_line, msg
81+
assert expected_msg.end_col_offset == gotten_msg.end_col_offset, msg
9882

9983
def walk(self, node: nodes.NodeNG) -> None:
10084
"""Recursive walk on the given node."""

0 commit comments

Comments
 (0)