diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2022-11-23 04:04:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 10:04:58 +0100 |
commit | 694d3024dbfea06aefd9288a99d7a375fe100859 (patch) | |
tree | a5c9db9cfbbbf742efa4f84b4038ba16154d5783 | |
parent | e2ef840528de633fdf8b826a9d7068345d8f371f (diff) | |
download | pylint-git-694d3024dbfea06aefd9288a99d7a375fe100859.tar.gz |
Fail pytest runs on warnings (#7809)
* Catch DeprecationWarning in pyreverse
Follow-up to #6869
* Patch use of deprecated `astroid.node_classes` in test
* Ignore DeprecationWarning in test_parseable_output_regression
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r-- | pyproject.toml | 1 | ||||
-rw-r--r-- | tests/functional/b/bad_reversed_sequence_py37.txt | 4 | ||||
-rw-r--r-- | tests/functional/s/star/star_needs_assignment_target_py37.txt | 2 | ||||
-rw-r--r-- | tests/pyreverse/test_inspector.py | 5 | ||||
-rw-r--r-- | tests/pyreverse/test_utils.py | 2 | ||||
-rw-r--r-- | tests/reporters/unittest_reporting.py | 1 |
6 files changed, 10 insertions, 5 deletions
diff --git a/pyproject.toml b/pyproject.toml index 27e6a36e5..401106a3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,6 +89,7 @@ test = "pytest" testpaths = ["tests"] python_files = ["*test_*.py"] addopts = "--strict-markers" +filterwarnings = "error" markers = [ "primer_stdlib: Checks for crashes and errors when running pylint on stdlib", "primer_external_batch_one: Checks for crashes and errors when running pylint on external libs (batch one)", diff --git a/tests/functional/b/bad_reversed_sequence_py37.txt b/tests/functional/b/bad_reversed_sequence_py37.txt index d87c84690..6fbbd2c59 100644 --- a/tests/functional/b/bad_reversed_sequence_py37.txt +++ b/tests/functional/b/bad_reversed_sequence_py37.txt @@ -1,2 +1,2 @@ -bad-reversed-sequence:5:::The first reversed() argument is not a sequence -bad-reversed-sequence:12:::The first reversed() argument is not a sequence +bad-reversed-sequence:5:0:5:26::The first reversed() argument is not a sequence:UNDEFINED +bad-reversed-sequence:12:0:12:39::The first reversed() argument is not a sequence:UNDEFINED diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.txt b/tests/functional/s/star/star_needs_assignment_target_py37.txt index a4fa2caea..fb5a5faa6 100644 --- a/tests/functional/s/star/star_needs_assignment_target_py37.txt +++ b/tests/functional/s/star/star_needs_assignment_target_py37.txt @@ -1 +1 @@ -star-needs-assignment-target:15:37::Can use starred expression only in assignment target +star-needs-assignment-target:15:36:15:46::Can use starred expression only in assignment target:UNDEFINED diff --git a/tests/pyreverse/test_inspector.py b/tests/pyreverse/test_inspector.py index 623a828b5..00cad918f 100644 --- a/tests/pyreverse/test_inspector.py +++ b/tests/pyreverse/test_inspector.py @@ -9,6 +9,7 @@ from __future__ import annotations import os +import warnings from collections.abc import Generator from pathlib import Path @@ -30,7 +31,9 @@ def project(get_project: GetProjectCallable) -> Generator[Project, None, None]: with _test_cwd(TESTS): project = get_project("data", "data") linker = inspector.Linker(project) - linker.visit(project) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=DeprecationWarning) + linker.visit(project) yield project diff --git a/tests/pyreverse/test_utils.py b/tests/pyreverse/test_utils.py index 1636a8896..d64bf4fa7 100644 --- a/tests/pyreverse/test_utils.py +++ b/tests/pyreverse/test_utils.py @@ -117,7 +117,7 @@ def test_infer_node_1(mock_infer: Any, mock_get_annotation: Any) -> None: @patch("pylint.pyreverse.utils.get_annotation") -@patch("astroid.node_classes.NodeNG.infer") +@patch("astroid.nodes.NodeNG.infer") def test_infer_node_2(mock_infer: Any, mock_get_annotation: Any) -> None: """Return set(node.infer()) when InferenceError is not raised and an annotation has not been returned diff --git a/tests/reporters/unittest_reporting.py b/tests/reporters/unittest_reporting.py index 6b5797237..7b8139119 100644 --- a/tests/reporters/unittest_reporting.py +++ b/tests/reporters/unittest_reporting.py @@ -137,6 +137,7 @@ def test_parseable_output_deprecated() -> None: def test_parseable_output_regression() -> None: output = StringIO() with warnings.catch_warnings(record=True): + warnings.simplefilter("ignore", category=DeprecationWarning) linter = PyLinter(reporter=ParseableTextReporter()) checkers.initialize(linter) |