X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_message_iterator.py;h=31f4192126d33940bc28bd7eefb665d50c68351f;hb=8e97c3332d66c85786f42f3189e3022a518ed20b;hp=3cd27e5b77325536a7c8735756edd539bf76ec01;hpb=6c373cc905e907ecbad698fee38db1d47a981b14;p=babeltrace.git diff --git a/tests/bindings/python/bt2/test_message_iterator.py b/tests/bindings/python/bt2/test_message_iterator.py index 3cd27e5b..31f41921 100644 --- a/tests/bindings/python/bt2/test_message_iterator.py +++ b/tests/bindings/python/bt2/test_message_iterator.py @@ -21,6 +21,7 @@ import collections import unittest import copy import bt2 +import sys from utils import TestOutputPortMessageIterator @@ -405,10 +406,12 @@ class UserMessageIteratorTestCase(unittest.TestCase): src = graph.add_component(MySource, 'src') it = TestOutputPortMessageIterator(graph, src.output_ports['out']) - # The initial refcount of Py_None was in the 7000, so 100000 iterations - # should be enough to catch the bug even if there are small differences + # Three times the initial ref count of `None` iterations should + # be enough to catch the bug even if there are small differences # between configurations. - for i in range(100000): + none_ref_count = sys.getrefcount(None) * 3 + + for i in range(none_ref_count): with self.assertRaises(bt2.TryAgain): next(it)