diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index ef81784f4..e98dc5c37 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -100,6 +100,9 @@ pytest_cmdline_main.tryfirst = True def deselect_by_keyword(items, config): keywordexpr = config.option.keyword.lstrip() + if not keywordexpr: + return + if keywordexpr.startswith("-"): keywordexpr = "not " + keywordexpr[1:] selectuntil = False