Skip to content

Commit 612b873

Browse files
committed
Fixed style issues reported by flake8. Added gc.collect.
The latter is in the hope of it fixing the test under PyPy.
1 parent 2d04bd2 commit 612b873

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/test_consume.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import gc
2+
3+
14
def test_consume_argument(capture):
25
from pybind11_tests import Box, Filter
36

@@ -15,24 +18,25 @@ def test_consume_argument(capture):
1518
assert Box.get_num_boxes() == 2
1619

1720
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
1922
assert capture == "Box is processed by Filter."
2023

2124
assert Box.get_num_boxes() == 2
2225

2326
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
2528
assert capture == """
2629
Box is processed by Filter.
2730
Box destroyed.
2831
"""
2932

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
3134

3235
with capture:
3336
del filt
3437
del box_1
3538
del box_8
39+
gc.collect()
3640
assert capture == "Filter destroyed."
3741

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

0 commit comments

Comments
 (0)