diff --git a/src/_pytest/mark/legacy.py b/src/_pytest/mark/legacy.py index 3d7a194b6..80a520a0a 100644 --- a/src/_pytest/mark/legacy.py +++ b/src/_pytest/mark/legacy.py @@ -112,5 +112,5 @@ def matchkeyword(colitem, keywordexpr): ) try: return eval(keywordexpr, {}, mapping) - except SyntaxError: + except Exception: raise UsageError("Wrong expression passed to '-k': {}".format(keywordexpr))