diff --git a/ebuild/plugins/__init__.py b/ebuild/plugins/__init__.py index 3353ea5..54605f0 100644 --- a/ebuild/plugins/__init__.py +++ b/ebuild/plugins/__init__.py @@ -11,7 +11,7 @@ import importlib.metadata import logging -from typing import List +from typing import Any, List, Mapping, cast from ebuild.plugins.base import PluginBase @@ -41,9 +41,12 @@ def discover_plugins() -> List[PluginBase]: if hasattr(entry_points, "select"): eps = entry_points.select(group="ebuild.plugins") else: - # Before 3.10 entry_points() returned a dict; the current stubs - # only model EntryPoints, which has no .get, hence the ignore. - eps = entry_points.get("ebuild.plugins", []) # type: ignore[attr-defined] + # Before 3.10, entry_points() returned a mapping of group name + # to entry points. The stubs only model the modern EntryPoints, so + # spell the old shape out rather than widen the ignore: the + # `# type: ignore[attr-defined]` that was here named the wrong + # error code, and mypy failed on the line anyway. + eps = cast(Mapping[str, Any], entry_points).get("ebuild.plugins", []) for ep in eps: try: diff --git a/tests/ebuild/test_build_dir_resolution.py b/tests/ebuild/test_build_dir_resolution.py index a19be13..e08444f 100644 --- a/tests/ebuild/test_build_dir_resolution.py +++ b/tests/ebuild/test_build_dir_resolution.py @@ -28,7 +28,6 @@ import os import shutil import subprocess -import shutil import textwrap from pathlib import Path from types import SimpleNamespace diff --git a/tests/ebuild/test_package_recipe.py b/tests/ebuild/test_package_recipe.py index 38c38de..3c25922 100644 --- a/tests/ebuild/test_package_recipe.py +++ b/tests/ebuild/test_package_recipe.py @@ -114,4 +114,4 @@ def test_depends_alias_must_be_a_list(): """ with pytest.raises(RecipeError, match="dependencies"): - load_recipe_from_string(content) \ No newline at end of file + load_recipe_from_string(content) diff --git a/tests/unit/test_ci_gate.py b/tests/unit/test_ci_gate.py index 964ca54..b1d5e0f 100644 --- a/tests/unit/test_ci_gate.py +++ b/tests/unit/test_ci_gate.py @@ -11,9 +11,12 @@ required check does not cover. """ +import itertools +import re +from pathlib import Path + import yaml import pytest -from pathlib import Path WORKFLOWS_DIR = Path(__file__).resolve().parents[2] / ".github" / "workflows" @@ -211,9 +214,6 @@ def test_gate_fails_on_any_non_success_result(jobs): # check cannot say which of the three it means, and a Windows-only failure is # indistinguishable from the other two legs without opening the run. -import itertools -import re - # `include` and `exclude` shape a matrix but are not dimensions of it, so they # are not part of the cartesian product. _NOT_A_DIMENSION = {"include", "exclude"}