Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9176e67

Browse files
committed
run_tests.py: refleak logs run number
1 parent 8ae3196 commit 9176e67

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/run_tests.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ def _run_tests(tests, verbose):
7070
test_func()
7171

7272

73-
def _check_refleak(test_func):
74-
for iteration in range(6):
73+
def _check_refleak(test_func, verbose):
74+
nrun = 6
75+
for i in range(1, nrun + 1):
76+
if verbose:
77+
if i > 1:
78+
print()
79+
print(f"Run {i}/{nrun}:")
80+
7581
init_refcnt = sys.gettotalrefcount()
7682
test_func()
7783
diff = sys.gettotalrefcount() - init_refcnt;
7884

79-
if iteration > 3 and diff:
85+
if i > 3 and diff:
8086
raise AssertionError(f"refcnt leak, diff: {diff}")
8187

8288

@@ -93,7 +99,7 @@ def test_func():
9399
_run_tests(tests, VERBOSE)
94100

95101
if check_refleak:
96-
_check_refleak(test_func)
102+
_check_refleak(test_func, VERBOSE)
97103
else:
98104
test_func()
99105

0 commit comments

Comments
 (0)