1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/60f144dcdcf4/ changeset: 60f144dcdcf4 user: RonnyPfannschmidt date: 2012-08-19 13:45:26 summary: fix issue 176: raises(AssertionError) now catches builtin AssertionError as well affected #: 3 files diff -r 4797ffd8162188aa2a82fd725bcc0483bdd008fd -r 60f144dcdcf4a488ef1114ead43a7d59df8f4663 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -44,6 +44,10 @@ - fix issue 178: xml binary escapes are now wrapped in py.xml.raw +- fix issue 176: correctly catch the builtin AssertionError + even when we replaced AssertionError with a subclass on the + python level + - factory discovery no longer fails with magic global callables that provide no sane __code__ object (mock.call for example) diff -r 4797ffd8162188aa2a82fd725bcc0483bdd008fd -r 60f144dcdcf4a488ef1114ead43a7d59df8f4663 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -777,6 +777,11 @@ <ExceptionInfo ...> """ __tracebackhide__ = True + if ExpectedException is AssertionError: + # we want to catch a AssertionError + # replace our subclass with the builtin one + # see https://bitbucket.org/hpk42/pytest/issue/176/pytestraises + from exceptions import AssertionError as ExpectedException if not args: return RaisesContext(ExpectedException) diff -r 4797ffd8162188aa2a82fd725bcc0483bdd008fd -r 60f144dcdcf4a488ef1114ead43a7d59df8f4663 testing/test_python.py --- a/testing/test_python.py +++ b/testing/test_python.py @@ -1419,6 +1419,14 @@ except pytest.raises.Exception: pass + def test_raises_flip_builtin_AssertionError(self): + # we replace AssertionError on python level + # however c code might still raise the builtin one + import exceptions + pytest.raises(AssertionError,""" + raise exceptions.AssertionError + """) + @pytest.mark.skipif('sys.version < "2.5"') def test_raises_as_contextmanager(self, testdir): testdir.makepyfile(""" 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