Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deprecation] end_line and end_col_offset required in functional tests #8466

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Following a deprecation period, it's no longer possible to use ``MASTER``
or ``master`` as configuration section in ``setup.cfg`` or ``tox.ini``. It's bad practice
to not start sections titles with the tool name. Please use ``pylint.main`` instead.

Refs #8464
Refs #8465
5 changes: 5 additions & 0 deletions doc/whatsnew/fragments/8466.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Following a deprecation period, ``MessageTest``'s ``end_line`` and ``end_col_offset``
must be accurate in functional tests (for python 3.8 or above on cpython, and for
python 3.9 or superior on pypy).

Refs #8466
20 changes: 2 additions & 18 deletions pylint/testutils/checker_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from __future__ import annotations

import contextlib
import warnings
from collections.abc import Generator, Iterator
from typing import Any

Expand Down Expand Up @@ -78,23 +77,8 @@ def assertAddsMessages(
assert expected_msg.line == gotten_msg.line, msg
assert expected_msg.col_offset == gotten_msg.col_offset, msg
if PY38_PLUS and not IS_PYPY or PY39_PLUS:
# TODO: 3.0: Remove deprecated missing arguments and remove the warning
if not expected_msg.end_line == gotten_msg.end_line:
warnings.warn( # pragma: no cover
f"The end_line attribute of {gotten_msg} does not match "
f"the expected value in {expected_msg}. In pylint 3.0 correct end_line "
"attributes will be required for MessageTest.",
DeprecationWarning,
stacklevel=2,
)
if not expected_msg.end_col_offset == gotten_msg.end_col_offset:
warnings.warn( # pragma: no cover
f"The end_col_offset attribute of {gotten_msg} does not match "
f"the expected value in {expected_msg}. In pylint 3.0 correct end_col_offset "
"attributes will be required for MessageTest.",
DeprecationWarning,
stacklevel=2,
)
assert expected_msg.end_line == gotten_msg.end_line, msg
assert expected_msg.end_col_offset == gotten_msg.end_col_offset, msg

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