Closed
Description
Originally reported by: Jim Garrison (BitBucket: garrison, GitHub: 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?