We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed1d1b1 commit ac46609Copy full SHA for ac46609
src/_pytest/assertion/rewrite.py
@@ -789,9 +789,6 @@ def visit_Assert(self, assert_):
789
self.variables = [] # type: List[str]
790
self.variable_counter = itertools.count()
791
792
- if self.enable_assertion_pass_hook:
793
- self.format_variables = [] # type: List[str]
794
-
795
self.stack = [] # type: List[Dict[str, ast.expr]]
796
self.expl_stmts = [] # type: List[ast.stmt]
797
self.push_format_context()
@@ -808,6 +805,7 @@ def visit_Assert(self, assert_):
808
805
negation = ast.UnaryOp(ast.Not(), top_condition)
809
806
810
807
if self.enable_assertion_pass_hook: # Experimental pytest_assertion_pass hook
+ self.format_variables = [] # type: List[str]
811
msg = self.pop_format_context(ast.Str(explanation))
812
813
# Failed
0 commit comments