--- you can reply above this line ---

New issue 176: pytest.raises(AssertionError) fails with cython modules
https://bitbucket.org/hpk42/pytest/issue/176/pytestraises-assertionerror-fails-with

Jim Garrison:

Define the files python_assert.py and cython_assert.pyx to be identical, each 
containing a simple function that raises AssertionError:

{{{
#!python
def raise_assertionerror():
    assert False
}}}

I would expect both of the following tests to succeed under pytest:

{{{
#!python
import pytest

import pyximport
pyximport.install()

from python_assert import raise_assertionerror as python_assert
from cython_assert import raise_assertionerror as cython_assert

def test_assertion():
    with pytest.raises(AssertionError):
        python_assert()

def test_cython_assertion():
    with pytest.raises(AssertionError):
        cython_assert()
}}}

However, the cython test fails.

This seems to be a problem with pytest because the equivalent unittest succeeds.

Further, the pytest test succeeds if we call pytest.raises(Exception) instead 
of pytest.raises(AssertionError).

Any idea what is wrong?


--

This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to