From f4897391ec65b6f7b162d93b7b48a6587f9b659b Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Fri, 21 Jun 2024 14:04:42 +0200 Subject: [PATCH] refactor(mark): use existing `NOT_SET` sentinel --- src/_pytest/mark/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index ae6940a62..ddfa8355a 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -22,6 +22,7 @@ from _pytest.config import Config from _pytest.config import ExitCode from _pytest.config import hookimpl from _pytest.config import UsageError +from _pytest.config.argparsing import NOT_SET from _pytest.config.argparsing import Parser from _pytest.stash import StashKey @@ -214,9 +215,6 @@ def deselect_by_keyword(items: list[Item], config: Config) -> None: items[:] = remaining -NOT_NONE_SENTINEL = object() - - @dataclasses.dataclass class MarkMatcher: """A matcher for markers which are present. @@ -243,9 +241,7 @@ class MarkMatcher: return True for mark in matches: - if all( - mark.kwargs.get(k, NOT_NONE_SENTINEL) == v for k, v in kwargs.items() - ): + if all(mark.kwargs.get(k, NOT_SET) == v for k, v in kwargs.items()): return True return False