refactor assert interpretation to invoke a simple callable

and let the assertion plugin handle the hook invocation
and its multi-results and also pass in an (optional) test config
object to the hook. Add and refactor also a few tests.

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-10-02 18:47:39 +02:00
parent b56d3c223d
commit 1ff173baee
7 changed files with 123 additions and 90 deletions

View File

@@ -217,3 +217,13 @@ def test_underscore_api():
py.code._AssertionError
py.code._reinterpret_old # used by pypy
py.code._reinterpret
@py.test.mark.skipif("sys.version_info < (2,6)")
def test_assert_customizable_binrepr(monkeypatch):
monkeypatch.setattr(py.code, '_binrepr', lambda *args: 'hello')
try:
assert 3 == 4
except AssertionError:
e = exvalue()
s = str(e)
assert "hello" in s