refactor(mark): use existing `NOT_SET` sentinel
This commit is contained in:
parent
1cc35ecc3f
commit
f4897391ec
|
@ -22,6 +22,7 @@ from _pytest.config import Config
|
||||||
from _pytest.config import ExitCode
|
from _pytest.config import ExitCode
|
||||||
from _pytest.config import hookimpl
|
from _pytest.config import hookimpl
|
||||||
from _pytest.config import UsageError
|
from _pytest.config import UsageError
|
||||||
|
from _pytest.config.argparsing import NOT_SET
|
||||||
from _pytest.config.argparsing import Parser
|
from _pytest.config.argparsing import Parser
|
||||||
from _pytest.stash import StashKey
|
from _pytest.stash import StashKey
|
||||||
|
|
||||||
|
@ -214,9 +215,6 @@ def deselect_by_keyword(items: list[Item], config: Config) -> None:
|
||||||
items[:] = remaining
|
items[:] = remaining
|
||||||
|
|
||||||
|
|
||||||
NOT_NONE_SENTINEL = object()
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
class MarkMatcher:
|
class MarkMatcher:
|
||||||
"""A matcher for markers which are present.
|
"""A matcher for markers which are present.
|
||||||
|
@ -243,9 +241,7 @@ class MarkMatcher:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for mark in matches:
|
for mark in matches:
|
||||||
if all(
|
if all(mark.kwargs.get(k, NOT_SET) == v for k, v in kwargs.items()):
|
||||||
mark.kwargs.get(k, NOT_NONE_SENTINEL) == v for k, v in kwargs.items()
|
|
||||||
):
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue