[Pytest-commit] Issue #528: Test causes segfault (hpk42/pytest)

timothy issues-reply at bitbucket.org
Fri Jun 13 18:53:48 CEST 2014


New issue 528: Test causes segfault
https://bitbucket.org/hpk42/pytest/issue/528/test-causes-segfault

timothy:

```
#!python

import unittest

import functools

def dec(f):
    @functools.wraps(f)
    def wrap(*a, **kw):
        assert f.__annotations__.get('a') == 'equal'
    return wrap

class TestClass(object):
    @dec
    def __init__(self, a:'not'):
        self.a = a

class TestSegfault(unittest.TestCase):

    def test_segfault(self):
        with self.assertRaises(IOError):
            TestClass()

if __name__ == '__main__':
    unittest.main()
```

py.test -v


```
#!

============================= test session starts ==============================

platform linux -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2 -- /home/vagrant/py_
env/bin/python
collected 1 items / 1 skipped

test_segfault.py:18: TestSegfault.test_segfault Segmentation fault
```

python:

```
#!

F
======================================================================
FAIL: test_segfault (__main__.TestSegfault)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_segfault.py", line 20, in test_segfault
    TestClass()
  File "test_segfault.py", line 8, in wrap
    assert f.__annotations__.get('a') == 'equal'
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)
```





More information about the pytest-commit mailing list