"""Find leaks in idlelib. Check with git status that worktree is clean. Revised from findleak.py uploaded to https://bugs.python.org/issue30642 to use -m to select one idle_test module, but does not seem to work. """ import os import subprocess def test1(name): "Test module with filename *name*." try: print(name) res = subprocess.run( [worktree+'python.bat', '-m', 'test', '-R 3:3', '-ugui', 'test_idle', '-m', f'idlelib.idle_test.{name[:-3]}.*.*'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) print(res.stdout.decode()) print(res.stderr.decode()) except Exception as err: print(name, err) worktree = 'f:/dev/3x/' os.chdir(worktree + "/Lib/idlelib/idle_test") testfiles = [name for name in os.listdir() if name.startswith('test_')] for file in testfiles: test1(file)