File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change
1
+ import gc
2
+
3
+
1
4
def test_consume_argument (capture ):
2
5
from pybind11_tests import Box , Filter
3
6
@@ -15,24 +18,25 @@ def test_consume_argument(capture):
15
18
assert Box .get_num_boxes () == 2
16
19
17
20
with capture :
18
- filt .process (box_1 ) # box_1 is not big enough, but process() leaks it
21
+ filt .process (box_1 ) # box_1 is not big enough, but process() leaks it
19
22
assert capture == "Box is processed by Filter."
20
23
21
24
assert Box .get_num_boxes () == 2
22
25
23
26
with capture :
24
- filt .process (box_8 ) # box_8 is destroyed by process() of filt
27
+ filt .process (box_8 ) # box_8 is destroyed by process() of filt
25
28
assert capture == """
26
29
Box is processed by Filter.
27
30
Box destroyed.
28
31
"""
29
32
30
- assert Box .get_num_boxes () == 1 # box_1 still exists somehow, but we can't access it
33
+ assert Box .get_num_boxes () == 1 # box_1 still exists somehow, but we can't access it
31
34
32
35
with capture :
33
36
del filt
34
37
del box_1
35
38
del box_8
39
+ gc .collect ()
36
40
assert capture == "Filter destroyed."
37
41
38
- assert Box .get_num_boxes () == 1 # 1 box is leaked, and we can't do anything
42
+ assert Box .get_num_boxes () == 1 # 1 box is leaked, and we can't do anything
You can’t perform that action at this time.
0 commit comments