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