summaryrefslogtreecommitdiff
path: root/tests/config
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-15 12:27:46 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-15 13:01:35 +0200
commit2f7cb9870c61592bf663359fb21250e007c022fe (patch)
treeacefaaaa6672bb585ac379d07b340aa66952b9b2 /tests/config
parent63173f8f3a21671155c9a3122c5ecaa8a66ce0b5 (diff)
downloadpylint-git-2f7cb9870c61592bf663359fb21250e007c022fe.tar.gz
Deprecate ``get_global_option``
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/test_deprecations.py7
-rw-r--r--tests/config/unittest_config.py9
2 files changed, 10 insertions, 6 deletions
diff --git a/tests/config/test_deprecations.py b/tests/config/test_deprecations.py
index cbbb558d7..8f0bb7a8b 100644
--- a/tests/config/test_deprecations.py
+++ b/tests/config/test_deprecations.py
@@ -11,6 +11,7 @@ import pytest
from pylint.checkers import BaseChecker
from pylint.lint import PyLinter
+from pylint.utils import get_global_option
class SampleChecker(BaseChecker):
@@ -60,6 +61,12 @@ class TestDeprecationArgumentsManager:
with pytest.warns(DeprecationWarning):
self.linter.load_defaults()
+ def test_get_global_option(self) -> None:
+ """Test that get_global_option emits a DeprecationWarning."""
+ checker = BaseChecker(self.linter)
+ with pytest.warns(DeprecationWarning):
+ get_global_option(checker, "test-opt") # type: ignore[call-overload]
+
def test_read_config_file(self) -> None:
"""Test that read_config_file emits a DeprecationWarning."""
with pytest.warns(DeprecationWarning):
diff --git a/tests/config/unittest_config.py b/tests/config/unittest_config.py
index c282ebe38..cd36ef895 100644
--- a/tests/config/unittest_config.py
+++ b/tests/config/unittest_config.py
@@ -14,7 +14,6 @@ import pytest
from pylint import config
from pylint.checkers import BaseChecker
from pylint.testutils import CheckerTestCase, set_config
-from pylint.utils.utils import get_global_option
def test__regexp_validator_valid() -> None:
@@ -61,9 +60,7 @@ def test__regexp_csv_validator_invalid() -> None:
class TestPyLinterOptionSetters(CheckerTestCase):
- """Class to check the set_config decorator and get_global_option util
- for options declared in PyLinter.
- """
+ """Class to check the set_config decorator for options declared in PyLinter."""
class Checker(BaseChecker):
name = "checker"
@@ -75,7 +72,7 @@ class TestPyLinterOptionSetters(CheckerTestCase):
@set_config(ignore_paths=".*/tests/.*,.*\\ignore\\.*")
def test_ignore_paths_with_value(self) -> None:
"""Test ignore-paths option with value."""
- options = get_global_option(self.checker, "ignore-paths")
+ options = self.linter.config.ignore_paths
assert any(i.match("dir/tests/file.py") for i in options)
assert any(i.match("dir\\tests\\file.py") for i in options)
@@ -86,6 +83,6 @@ class TestPyLinterOptionSetters(CheckerTestCase):
"""Test ignore-paths option with no value.
Compare against actual list to see if validator works.
"""
- options = get_global_option(self.checker, "ignore-paths")
+ options = self.linter.config.ignore_paths
assert options == []