Skip to content

Commit

Permalink
Fix ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry-git committed Jan 29, 2024
1 parent fb682b7 commit f2d7616
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion tests/test_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from pytest_split.algorithms import Algorithms

item = namedtuple("item", "nodeid")
item = namedtuple("item", "nodeid") # noqa: PYI024


class TestAlgorithms:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import itertools
import json
import os
from typing import ClassVar

import pytest
from _pytest.main import ExitCode
Expand Down Expand Up @@ -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):
Expand All @@ -99,7 +100,7 @@ def test_it_does_not_store_without_flag(self, example_suite, durations_path):


class TestSplitToSuites:
parameters = [
parameters: ClassVar = [
(
1,
1,
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit f2d7616

Please sign in to comment.