File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 Thanks `@nicoddemus `_ for the PR.
1111
1212* Fixed memory leak in the RaisesContext (pytest.raises) (`#1965 `_).
13- Thanks `@MSeifert04 `_ for the report the PR.
13+ Thanks `@MSeifert04 `_ for the report and the PR.
1414
1515*
1616
1717
1818.. _@cwitty : https://github.com/cwitty
19+ .. _@MSeifert04 : https://github.com/MSeifert04
1920
21+ .. _#1965 : https://github.com/pytest-dev/pytest/issues/1965
2022.. _#1976 : https://github.com/pytest-dev/pytest/issues/1976
2123.. _#1998 : https://github.com/pytest-dev/pytest/issues/1998
2224
Original file line number Diff line number Diff line change @@ -96,3 +96,21 @@ def test_custom_raise_message(self):
9696 assert e .msg == message
9797 else :
9898 assert False , "Expected pytest.raises.Exception"
99+
100+ @pytest .mark .parametrize ('method' , ['function' , 'with' ])
101+ def test_raises_memoryleak (self , method ):
102+ import weakref
103+
104+ class T :
105+ def __call__ (self ):
106+ raise ValueError
107+
108+ t = T ()
109+ if method == 'function' :
110+ pytest .raises (ValueError , t )
111+ else :
112+ with pytest .raises (ValueError ):
113+ t ()
114+
115+ t = weakref .ref (t )
116+ assert t () is None
You can’t perform that action at this time.
0 commit comments