[py-svn] commit/pytest: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Mon Jun 13 00:07:10 CEST 2011


2 new changesets in pytest:

http://bitbucket.org/hpk42/pytest/changeset/de3fc5db5bdc/
changeset:   de3fc5db5bdc
user:        gutworth
date:        2011-06-12 23:39:38
summary:     fix spacing
affected #:  1 file (2 bytes)

--- a/doc/assert.txt	Fri Jun 03 22:11:00 2011 -0500
+++ b/doc/assert.txt	Sun Jun 12 16:39:38 2011 -0500
@@ -179,11 +179,9 @@
 All assert introspection can be turned off by passing ``--assertmode=off``.
 
 .. versionadded:: 2.1
-
    Add assert rewriting as an alternate introspection technique.
 
 .. versionchanged:: 2.1
-
    Introduce the ``--assertmode`` option. Deprecate ``--no-assert`` and
    ``--nomagic``.
 


http://bitbucket.org/hpk42/pytest/changeset/25738adb7ef3/
changeset:   25738adb7ef3
user:        gutworth
date:        2011-06-13 00:07:49
summary:     some tweaks to allow pypy apptests to use newinterpret
affected #:  1 file (32 bytes)

--- a/_pytest/assertion/newinterpret.py	Sun Jun 12 16:39:38 2011 -0500
+++ b/_pytest/assertion/newinterpret.py	Sun Jun 12 17:07:49 2011 -0500
@@ -60,21 +60,18 @@
         frame = py.code.Frame(sys._getframe(1))
     return interpret(offending_line, frame)
 
-def getfailure(failure):
-    explanation = util.format_explanation(failure.explanation)
-    value = failure.cause[1]
+def getfailure(e):
+    explanation = util.format_explanation(e.explanation)
+    value = e.cause[1]
     if str(value):
-        lines = explanation.splitlines()
-        if not lines:
-            lines.append("")
-        lines[0] += " << %s" % (value,)
-        explanation = "\n".join(lines)
-    text = "%s: %s" % (failure.cause[0].__name__, explanation)
-    if text.startswith("AssertionError: assert "):
+        lines = explanation.split('\n')
+        lines[0] += "  << %s" % (e.value,)
+        explanation = '\n'.join(lines)
+    text = "%s: %s" % (e.cause[0].__name__, explanation)
+    if text.startswith('AssertionError: assert '):
         text = text[16:]
     return text
 
-
 operator_map = {
     ast.BitOr : "|",
     ast.BitXor : "^",
@@ -156,7 +153,7 @@
         except Exception:
             # have to assume it isn't
             local = False
-        if not local:
+        if not self.frame.is_true(local):
             return name.id, result
         return explanation, result
 
@@ -176,7 +173,7 @@
             except Exception:
                 raise Failure(explanation)
             try:
-                if not result:
+                if not self.frame.is_true(result):
                     break
             except KeyboardInterrupt:
                 raise
@@ -302,8 +299,8 @@
         try:
             from_instance = self.frame.eval(co, __exprinfo_expr=source_result)
         except Exception:
-            from_instance = True
-        if from_instance:
+            from_instance = None
+        if from_instance is None or self.frame.is_true(from_instance):
             rep = self.frame.repr(result)
             pattern = "%s\n{%s = %s\n}"
             explanation = pattern % (rep, rep, explanation)
@@ -312,10 +309,10 @@
     def visit_Assert(self, assrt):
         test_explanation, test_result = self.visit(assrt.test)
         if test_explanation.startswith("False\n{False =") and \
-                test_explanation.endswith("\n"):
+                test_explanation.endswith("\n}"):
             test_explanation = test_explanation[15:-2]
         explanation = "assert %s" % (test_explanation,)
-        if not test_result:
+        if not self.frame.is_true(test_result):
             try:
                 raise BuiltinAssertionError
             except Exception:

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.



More information about the pytest-commit mailing list