deselect_by_keyword: skip without expression

There is no need to iterate over all items always, if `-k` is not
specified.
This commit is contained in:
Daniel Hahler 2019-04-14 19:00:46 +02:00
parent 19035f4b55
commit 6a73714b00
1 changed files with 3 additions and 0 deletions

View File

@ -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