Skip to content

Commit

Permalink
Use pylint-pytest-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Aug 16, 2022
1 parent 5d83cd4 commit e6215ac
Show file tree
Hide file tree
Showing 21 changed files with 10 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pylint/testutils/lint_module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _get_actual(self) -> tuple[MessageCounter, list[OutputLine]]:
return received_msgs, received_output_lines

def _runTest(self) -> None:
__tracebackhide__ = True # pylint: disable=unused-variable
__tracebackhide__ = True
modules_to_check = [self._test_file.source]
self._linter.check(modules_to_check)
expected_messages, expected_output = self._get_expected()
Expand Down
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ load-plugins=
pylint.extensions.typing,
pylint.extensions.redefined_variable_type,
pylint.extensions.comparison_placement,
pylint_pytest_plugin,

# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
Expand Down
1 change: 1 addition & 0 deletions requirements_test_min.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# astroid dependency is also defined in pyproject.toml
astroid==2.12.2 # Pinned to a specific version for tests
typing-extensions~=4.3
pylint-pytest-plugin==0.1.0a2
pytest~=7.1
pytest-benchmark~=3.4
pytest-timeout~=2.1
Expand Down
2 changes: 0 additions & 2 deletions tests/checkers/unittest_unicode/unittest_bad_chars.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

import itertools
Expand Down
1 change: 0 additions & 1 deletion tests/config/test_functional_config_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
and ``"functional_remove":``. Check the existing code for examples.
"""

# pylint: disable=redefined-outer-name
import logging
import warnings
from pathlib import Path
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

import os
Expand Down
3 changes: 0 additions & 3 deletions tests/lint/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# Pytest fixtures work like this by design
# pylint: disable=redefined-outer-name

import sys
from pathlib import Path

Expand Down
6 changes: 2 additions & 4 deletions tests/lint/unittest_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

import argparse
Expand Down Expand Up @@ -418,8 +416,8 @@ def test_errors_only(initialized_linter: PyLinter) -> None:
linter = initialized_linter
linter._error_mode = True
linter._parse_error_mode()
checkers = linter.prepare_checkers()
checker_names = {c.name for c in checkers}
prepared_checkers = linter.prepare_checkers()
checker_names = {c.name for c in prepared_checkers}
should_not = {"design", "format", "metrics", "miscellaneous", "similarities"}
assert set() == should_not & checker_names

Expand Down
2 changes: 0 additions & 2 deletions tests/message/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

from collections.abc import ValuesView
Expand Down
2 changes: 1 addition & 1 deletion tests/primer/test_primer_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_primer_external_packages_no_crash_batch_one(
package: PackageToLint,
caplog: LogCaptureFixture,
) -> None:
__tracebackhide__ = True # pylint: disable=unused-variable
__tracebackhide__ = True
TestPrimer._primer_test(package, caplog)

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/primer/test_primer_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_primer_stdlib_no_crash(
test_module_location: str, test_module_name: str, capsys: CaptureFixture
) -> None:
"""Test that pylint does not produce any crashes or fatal errors on stdlib modules."""
__tracebackhide__ = True # pylint: disable=unused-variable
__tracebackhide__ = True
os.chdir(test_module_location)
with _patch_stdout(io.StringIO()):
try:
Expand Down
2 changes: 0 additions & 2 deletions tests/pyreverse/test_diadefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

"""Unit test for the extensions.diadefslib modules."""

# pylint: disable=redefined-outer-name

from __future__ import annotations

import sys
Expand Down
2 changes: 0 additions & 2 deletions tests/pyreverse/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

"""For the visitors.diadefs module."""

# pylint: disable=redefined-outer-name

from __future__ import annotations

import os
Expand Down
2 changes: 0 additions & 2 deletions tests/reporters/unittest_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

import sys
Expand Down
2 changes: 1 addition & 1 deletion tests/test_epylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

"""Test for issue https://github.com/PyCQA/pylint/issues/4286."""
# pylint: disable=redefined-outer-name

from pathlib import PosixPath

import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
def test_functional(
test_file: FunctionalTestFile, recwarn: WarningsRecorder, pytestconfig: Config
) -> None:
__tracebackhide__ = True # pylint: disable=unused-variable
__tracebackhide__ = True
if UPDATE_FILE.exists():
lint_test: (
LintModuleOutputUpdate | testutils.LintModuleTest
Expand Down
2 changes: 0 additions & 2 deletions tests/test_import_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

import os
Expand Down
2 changes: 0 additions & 2 deletions tests/test_regr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
to be incorporated in the automatic functional test framework
"""

# pylint: disable=redefined-outer-name

from __future__ import annotations

import os
Expand Down
2 changes: 1 addition & 1 deletion tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ def test_one_module_fatal_error(self) -> None:
"""Fatal errors in one of several modules linted still exits non-zero."""
valid_path = join(HERE, "conftest.py")
invalid_path = join(HERE, "garbagePath.py")
self._runtest([valid_path, invalid_path, "--disable=C"], code=1)
self._runtest([valid_path, invalid_path, "--disable=C"], code=5)

@pytest.mark.parametrize(
"args, expected",
Expand Down
2 changes: 0 additions & 2 deletions tests/testutils/test_lint_module_output_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

from collections.abc import Callable
Expand Down
2 changes: 0 additions & 2 deletions tests/testutils/test_output_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

# pylint: disable=redefined-outer-name

from __future__ import annotations

from collections.abc import Callable
Expand Down

0 comments on commit e6215ac

Please sign in to comment.