summaryrefslogtreecommitdiff
path: root/tests/config
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-04 20:20:23 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-04 20:21:46 +0200
commitce42d69f623bfab62d15263bc1d95bd0725c4701 (patch)
treed2f3235948e70b8e8d0fb85b733956c72d93803e /tests/config
parent6e77f8db3f42b3e778383ff387f5f455782e6f12 (diff)
downloadpylint-git-ce42d69f623bfab62d15263bc1d95bd0725c4701.tar.gz
Add tests for deprecated options
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/test_argparse_config.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/config/test_argparse_config.py b/tests/config/test_argparse_config.py
index cc399d995..2fa349698 100644
--- a/tests/config/test_argparse_config.py
+++ b/tests/config/test_argparse_config.py
@@ -4,6 +4,7 @@
"""Test for the (new) implementation of option parsing with argparse"""
+import re
from os.path import abspath, dirname, join
import pytest
@@ -54,3 +55,26 @@ class TestArgparseOptionsProviderMixin:
with pytest.raises(SystemExit) as ex:
Run([LOGGING_TEST, f"--rcfile={LOGGING_TEST.replace('.py', '.rc')}"])
assert ex.value.code == 0
+
+
+class TestDeprecationOptions:
+ @staticmethod
+ def test_new_names() -> None:
+ """Check that we correctly emit DeprecationWarnings for deprecated options."""
+ with pytest.raises(SystemExit) as ex:
+ with pytest.warns(DeprecationWarning) as records:
+ Run([EMPTY_MODULE, "--ignore-mixin-members=yes"])
+ assert len(records) == 1
+ assert "--ignore-mixin-members has been deprecated" in records[0]
+ assert ex.value.code == 0
+
+ @staticmethod
+ def test_old_names() -> None:
+ """Check that we correctly double assign old name options."""
+ run = Run([EMPTY_MODULE, "--ignore=test"], exit=False)
+ assert run.linter.namespace.ignore == ["test"]
+ assert run.linter.namespace.ignore == run.linter.namespace.black_list
+ assert run.linter.namespace.ignore_patterns == [re.compile("^\\.#")]
+ assert (
+ run.linter.namespace.ignore_patterns == run.linter.namespace.black_list_re
+ )