cpython: 72129c767c92 (original) (raw)

Mercurial > cpython

changeset 98492:72129c767c92

Issue #18174: "python -m test --huntrleaks ..." now also checks for leak of file descriptors. Patch written by Richard Oudkerk. [#18174]

Victor Stinner victor.stinner@gmail.com
date Sat, 03 Oct 2015 00:20:56 +0200
parents 4da7edbf78d4
children 1005573e6a74
files Lib/test/libregrtest/refleak.py Lib/test/test_regrtest.py Misc/NEWS
diffstat 3 files changed, 94 insertions(+), 19 deletions(-)[+] [-] Lib/test/libregrtest/refleak.py 47 Lib/test/test_regrtest.py 63 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/test/libregrtest/refleak.py +++ b/Lib/test/libregrtest/refleak.py @@ -1,3 +1,4 @@ +import errno import os import re import sys @@ -6,6 +7,36 @@ from inspect import isabstract from test import support +try:

+except Exception:

+ + +def fd_count():

+

+ + def dash_R(the_module, test, indirect_test, huntrleaks): """Run a test multiple times, looking for reference leaks. @@ -42,20 +73,25 @@ def dash_R(the_module, test, indirect_te repcount = nwarmup + ntracked rc_deltas = [0] * repcount alloc_deltas = [0] * repcount

print("beginning", repcount, "repetitions", file=sys.stderr) print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr, flush=True) # initialize variables to make pyflakes quiet

@@ -151,7 +188,7 @@ def dash_R_cleanup(fs, ps, pic, zdc, abc func1 = sys.getallocatedblocks func2 = sys.gettotalrefcount gc.collect()

def warm_caches():

--- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -383,27 +383,32 @@ class BaseTestCase(unittest.TestCase): self.assertTrue(0 <= randseed <= 10000000, randseed) return randseed

@@ -637,6 +642,36 @@ class ArgsTestCase(BaseTestCase): output = self.run_tests('--forever', test, exitcode=1) self.check_executed_tests(output, [test]*3, failed=test)

+

+

+

+

+

+ if name == 'main': unittest.main()

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -170,6 +170,9 @@ Documentation Tests ----- +- Issue #18174: python -m test --huntrleaks ... now also checks for leak of