diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index d9a241834..75056a483 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -206,13 +206,13 @@ class Expression: :param input: The input expression - one line. """ astexpr = expression(Scanner(input)) - + if mark: for node in ast.walk(astexpr): - #if the node is an identifier, i.e. a mark name - if isinstance(node, ast.Name): - MARK_GEN.verify_mark(node.id[len(IDENT_PREFIX):]) - + # if the node is an identifier, i.e. a mark name + if isinstance(node, ast.Name): + MARK_GEN.verify_mark(node.id[len(IDENT_PREFIX) :]) + code: types.CodeType = compile( astexpr, filename="",