]> git.madduck.net Git - etc/vim.git/blobdiff - tests/optional.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

black-primer: stop running it (#2809)
[etc/vim.git] / tests / optional.py
index e12b94cd29e47acf24a6f7b6cabefa7948526525..a4e9441ef1c98f9bfcfcc0776063fcf82e87dc35 100644 (file)
@@ -21,7 +21,12 @@ import re
 from typing import FrozenSet, List, Set, TYPE_CHECKING
 
 import pytest
 from typing import FrozenSet, List, Set, TYPE_CHECKING
 
 import pytest
-from _pytest.store import StoreKey
+
+try:
+    from pytest import StashKey
+except ImportError:
+    # pytest < 7
+    from _pytest.store import StoreKey as StashKey
 
 log = logging.getLogger(__name__)
 
 
 log = logging.getLogger(__name__)
 
@@ -33,8 +38,8 @@ if TYPE_CHECKING:
     from _pytest.nodes import Node
 
 
     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:
 
 
 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:
     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
         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