Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 24, 2023
1 parent 901d316 commit 9b759ab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
6 changes: 2 additions & 4 deletions pylint_pytest/checkers/class_attr_loader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional, Set

from astroid import Assign, Attribute, ClassDef, Name

from ..utils import _can_use_fixture, _is_class_autouse_fixture
Expand All @@ -10,8 +8,8 @@ class ClassAttrLoader(BasePytestChecker):
msgs = {"E6400": ("", "pytest-class-attr-loader", "")}

in_setup = False
request_cls: Set[str] = set()
class_node: Optional[ClassDef] = None
request_cls: set[str] = set()
class_node: ClassDef | None = None

def visit_functiondef(self, node):
"""determine if a method is a class setup method"""
Expand Down
9 changes: 4 additions & 5 deletions pylint_pytest/checkers/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import sys
from pathlib import Path
from typing import Set, Tuple

import astroid
import pylint
Expand All @@ -20,7 +19,7 @@
from .types import FixtureDict, replacement_add_message

# TODO: support pytest python_files configuration
FILE_NAME_PATTERNS: Tuple[str, ...] = ("test_*.py", "*_test.py")
FILE_NAME_PATTERNS: tuple[str, ...] = ("test_*.py", "*_test.py")
ARGUMENT_ARE_KEYWORD_ONLY = (
"https://docs.pytest.org/en/stable/deprecations.html#pytest-fixture-arguments-are-keyword-only"
)
Expand All @@ -29,7 +28,7 @@
class FixtureCollector:
# Same as ``_pytest.fixtures.FixtureManager._arg2fixturedefs``.
fixtures: FixtureDict = {}
errors: Set[pytest.CollectReport] = set()
errors: set[pytest.CollectReport] = set()

def pytest_sessionfinish(self, session):
# pylint: disable=protected-access
Expand Down Expand Up @@ -77,9 +76,9 @@ class FixtureChecker(BasePytestChecker):
# Store all fixtures discovered by pytest session
_pytest_fixtures: FixtureDict = {}
# Stores all used function arguments
_invoked_with_func_args: Set[str] = set()
_invoked_with_func_args: set[str] = set()
# Stores all invoked fixtures through @pytest.mark.usefixture(...)
_invoked_with_usefixtures: Set[str] = set()
_invoked_with_usefixtures: set[str] = set()
_original_add_message = replacement_add_message

def open(self):
Expand Down
4 changes: 2 additions & 2 deletions pylint_pytest/checkers/types.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import sys
from pprint import pprint
from typing import Any, Dict, List
from typing import Any

from _pytest.fixtures import FixtureDef

FixtureDict = Dict[str, List[FixtureDef[Any]]]
FixtureDict = dict[str, list[FixtureDef[Any]]]


def replacement_add_message(*args, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions tests/base_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from abc import ABC
from pprint import pprint
from typing import Any, Dict, List
from typing import Any

import astroid
from pylint.testutils import MessageTest, UnittestLinter
Expand All @@ -23,10 +23,10 @@

class BasePytestTester(ABC):
CHECKER_CLASS = BaseChecker
IMPACTED_CHECKER_CLASSES: List[BaseChecker] = []
IMPACTED_CHECKER_CLASSES: list[BaseChecker] = []
MSG_ID: str
msgs: List[MessageTest] = []
CONFIG: Dict[str, Any] = {}
msgs: list[MessageTest] = []
CONFIG: dict[str, Any] = {}

def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
Expand Down

0 comments on commit 9b759ab

Please sign in to comment.