added test (thanks @nicoddemus) and added links in Changelog

This commit is contained in:
Michael Seifert
2016-10-18 01:22:53 +02:00
committed by Bruno Oliveira
parent 1e5b21cd61
commit 552c7d4286
2 changed files with 24 additions and 4 deletions

View File

@@ -96,3 +96,21 @@ class TestRaises:
assert e.msg == message
else:
assert False, "Expected pytest.raises.Exception"
@pytest.mark.parametrize('method', ['function', 'with'])
def test_raises_memoryleak(self, method):
import weakref
class T:
def __call__(self):
raise ValueError
t = T()
if method == 'function':
pytest.raises(ValueError, t)
else:
with pytest.raises(ValueError):
t()
t = weakref.ref(t)
assert t() is None