Skip to content

Commit

Permalink
Add a test to check that no old msgid or symbol are used
Browse files Browse the repository at this point in the history
Closes #5729
  • Loading branch information
Pierre-Sassoulas committed Feb 25, 2022
1 parent b426411 commit a886026
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/message/test_no_removed_msgid_or_symbol_used.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
from typing import TYPE_CHECKING, List, NamedTuple, Tuple

if TYPE_CHECKING:
from pylint.lint import PyLinter


class DeletedMessage(NamedTuple):
msgid: str
symbol: str
old_names: List[Tuple[str, str]]


OLD_MSGID_SYMBOL_PAIR = [
DeletedMessage("W1601", "apply-builtin", []),
]


def test_no_removed_msgid_or_symbol_used(linter: "PyLinter") -> None:
"""Tests that we're not using deleted msgid or symbol.
This would be causing occasional bug, but more than that confusion and inconsistencies
when searching for the msgid online. See https://github.com/PyCQA/pylint/issues/5729
"""
for msgid, symbol, old_names in OLD_MSGID_SYMBOL_PAIR:
linter.msgs_store.message_id_store.register_message_definition(
msgid, symbol, old_names
)

0 comments on commit a886026

Please sign in to comment.