We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8d3e8b1 + f38f2d4 commit b820b7eCopy full SHA for b820b7e
src/_pytest/assertion/rewrite.py
@@ -807,8 +807,9 @@ def visit_Assert(self, assert_):
807
)
808
809
810
+ negation = ast.UnaryOp(ast.Not(), top_condition)
811
+
812
if self.enable_assertion_pass_hook: # Experimental pytest_assertion_pass hook
- negation = ast.UnaryOp(ast.Not(), top_condition)
813
msg = self.pop_format_context(ast.Str(explanation))
814
815
# Failed
@@ -860,7 +861,6 @@ def visit_Assert(self, assert_):
860
861
else: # Original assertion rewriting
862
# Create failure message.
863
body = self.expl_stmts
864
self.statements.append(ast.If(negation, body, []))
865
if assert_.msg:
866
assertmsg = self.helper("_format_assertmsg", assert_.msg)
0 commit comments