better error messages as discussed here:

http://codespeak.net/pipermail/py-dev/2009q2/001113.html

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-04-28 18:11:38 +02:00
parent 975e681552
commit 46be553c25
2 changed files with 4 additions and 4 deletions

View File

@ -428,9 +428,9 @@ def interpret(source, frame, should_fail=False):
import traceback
traceback.print_exc()
if should_fail:
return ("(assert failed but re-evaluating the assert expression "
"for printing intermediate values lead to a True value. "
"advise: avoid side-effects in assert expressions or use --nomagic)")
return ("(assertion failed, but when it was re-run for "
"printing intermediate values, it did not fail. Suggestions: "
"compute assert expression before the assert or use --nomagic)")
else:
return None

View File

@ -129,5 +129,5 @@ def test_inconsistent_assert_result(testdir):
""")
result = testdir.runpytest(p)
s = result.stdout.str()
assert s.find("re-evaluating")
assert s.find("re-run") != -1