1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/cd8ca99f4011/ changeset: cd8ca99f4011 user: gutworth date: 2011-10-14 22:26:13 summary: put the explanation generating code in the conditional fail body (fixes #79) affected #: 3 files (-1 bytes)
--- a/CHANGELOG Thu Sep 29 23:44:26 2011 +0200 +++ b/CHANGELOG Fri Oct 14 16:26:13 2011 -0400 @@ -1,6 +1,7 @@ Changes between 2.1.2 and [next version] ---------------------------------------- +- fix issue79: rewriting failed on some comparisons in boolops - correctly handle zero length arguments (a la pytest '') - fix issue67 / junitxml now contains correct test durations, thanks ronny - fix issue75 / skipping test failure on jython --- a/_pytest/assertion/rewrite.py Thu Sep 29 23:44:26 2011 +0200 +++ b/_pytest/assertion/rewrite.py Fri Oct 14 16:26:13 2011 -0400 @@ -491,13 +491,13 @@ self.push_format_context() # Process each operand, short-circuting if needed. for i, v in enumerate(boolop.values): - self.push_format_context() - res, expl = self.visit(v) - body.append(ast.Assign([ast.Name(res_var, ast.Store())], res)) if i: fail_inner = [] self.on_failure.append(ast.If(cond, fail_inner, [])) self.on_failure = fail_inner + self.push_format_context() + res, expl = self.visit(v) + body.append(ast.Assign([ast.Name(res_var, ast.Store())], res)) expl_format = self.pop_format_context(ast.Str(expl)) call = ast.Call(app, [expl_format], [], None, None) self.on_failure.append(ast.Expr(call)) --- a/testing/test_assertrewrite.py Thu Sep 29 23:44:26 2011 +0200 +++ b/testing/test_assertrewrite.py Fri Oct 14 16:26:13 2011 -0400 @@ -145,6 +145,14 @@ assert False or x() assert getmsg(f, {"x" : x}) == "assert (False or x())" def f(): + assert 1 in {} and 2 in {} + assert getmsg(f) == "assert (1 in {})" + def f(): + x = 1 + y = 2 + assert x in {1 : None} and y in {} + assert getmsg(f) == "assert (1 in {1: None} and 2 in {})" + def f(): f = True g = False assert f or g Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn