Skip to content

Commit 61ad88d

Browse files
committed
add wait to cleanup gc refs
1 parent bd97f81 commit 61ad88d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_message.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def await_gc(gc_key):
3737
which can take some time to receive its DECREF message.
3838
"""
3939
deadline = time.monotonic() + 3
40+
gc.collect()
4041
while time.monotonic() < deadline:
4142
if gc_key in zmq_gc.refs:
4243
time.sleep(0.05)
@@ -56,6 +57,11 @@ def tearDown(self):
5657
super().tearDown()
5758
for i in range(3):
5859
gc.collect()
60+
61+
deadline = time.monotonic() + 3
62+
while zmq_gc.refs and time.monotonic() < deadline:
63+
time.sleep(0.05)
64+
5965
# make sure we left no refs
6066
assert not zmq_gc.refs
6167

0 commit comments

Comments
 (0)