X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/d5c95f6a8f274f42cce81bfe544266a7bb53474b..d1aee5f7fa136b1f0a7d8dfc318af81009074070:/.vim/bundle/black/tests/optional.py diff --git a/.vim/bundle/black/tests/optional.py b/.vim/bundle/black/tests/optional.py index e12b94c..3f5277b 100644 --- a/.vim/bundle/black/tests/optional.py +++ b/.vim/bundle/black/tests/optional.py @@ -14,27 +14,32 @@ Specifying the name of the default behavior in `--run-optional=` is harmless. Adapted from https://pypi.org/project/pytest-optional-tests/, (c) 2019 Reece Hart """ -from functools import lru_cache import itertools import logging import re -from typing import FrozenSet, List, Set, TYPE_CHECKING +from functools import lru_cache +from typing import TYPE_CHECKING, FrozenSet, List, Set import pytest -from _pytest.store import StoreKey + +try: + from pytest import StashKey +except ImportError: + # pytest < 7 + from _pytest.store import StoreKey as StashKey # type: ignore[import, no-redef] log = logging.getLogger(__name__) if TYPE_CHECKING: - from _pytest.config.argparsing import Parser from _pytest.config import Config + from _pytest.config.argparsing import Parser from _pytest.mark.structures import MarkDecorator from _pytest.nodes import Node -ALL_POSSIBLE_OPTIONAL_MARKERS = StoreKey[FrozenSet[str]]() -ENABLED_OPTIONAL_MARKERS = StoreKey[FrozenSet[str]]() +ALL_POSSIBLE_OPTIONAL_MARKERS = StashKey[FrozenSet[str]]() +ENABLED_OPTIONAL_MARKERS = StashKey[FrozenSet[str]]() def pytest_addoption(parser: "Parser") -> None: @@ -96,7 +101,7 @@ def pytest_collection_modifyitems(config: "Config", items: "List[Node]") -> None enabled_optional_markers = store[ENABLED_OPTIONAL_MARKERS] for item in items: - all_markers_on_test = set(m.name for m in item.iter_markers()) + all_markers_on_test = {m.name for m in item.iter_markers()} optional_markers_on_test = all_markers_on_test & all_possible_optional_markers if not optional_markers_on_test or ( optional_markers_on_test & enabled_optional_markers