diff --git a/pyproject.toml b/pyproject.toml index 97dcefb..f2e2ba1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,6 +110,7 @@ ignore = [ "S101", # "Use of `assert` detected" "SIM108", # "Use ternary operator ...". Ternary is harmful for readability in some cases. "TRY003", # "Avoid specifying long messages outside the exception class" + "FA100", # "Missing `from __future__ import annotations` ..." pytest-split supports a range of Python versions ] line-length = 88 target-version = "py37" diff --git a/tests/test_algorithms.py b/tests/test_algorithms.py index a4c40ae..3d9dcfb 100644 --- a/tests/test_algorithms.py +++ b/tests/test_algorithms.py @@ -11,7 +11,7 @@ from pytest_split.algorithms import Algorithms -item = namedtuple("item", "nodeid") +item = namedtuple("item", "nodeid") # noqa: PYI024 class TestAlgorithms: diff --git a/tests/test_ipynb.py b/tests/test_ipynb.py index 6e59033..9bc2000 100644 --- a/tests/test_ipynb.py +++ b/tests/test_ipynb.py @@ -4,7 +4,7 @@ from pytest_split.algorithms import Algorithms from pytest_split.ipynb_compatibility import ensure_ipynb_compatibility -item = namedtuple("item", "nodeid") +item = namedtuple("item", "nodeid") # noqa: PYI024 class TestIPyNb: diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 869c6a6..32c9cf2 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1,6 +1,7 @@ import itertools import json import os +from typing import ClassVar import pytest from _pytest.main import ExitCode @@ -90,7 +91,7 @@ def test_it_removes_old_when_cli_flag_used(self, example_suite, durations_path): durations = json.load(f) for item in old_durations: - assert item not in durations.keys() + assert item not in durations assert len(durations) == EXAMPLE_SUITE_TEST_COUNT def test_it_does_not_store_without_flag(self, example_suite, durations_path): @@ -99,7 +100,7 @@ def test_it_does_not_store_without_flag(self, example_suite, durations_path): class TestSplitToSuites: - parameters = [ + parameters: ClassVar = [ ( 1, 1, @@ -163,12 +164,12 @@ class TestSplitToSuites: (4, 3, "least_duration", ["test_2", "test_5", "test_7"]), (4, 4, "least_duration", ["test_3", "test_8"]), ] - legacy_duration = [True, False] - all_params = [ + legacy_duration: ClassVar = [True, False] + all_params: ClassVar = [ (*param, legacy_flag) for param, legacy_flag in itertools.product(parameters, legacy_duration) ] - enumerated_params = [(i, *param) for i, param in enumerate(all_params)] + enumerated_params: ClassVar = [(i, *param) for i, param in enumerate(all_params)] @pytest.mark.parametrize( ("test_idx", "splits", "group", "algo", "expected", "legacy_flag"),