[New-bugs-announce] [issue9895] Speed up test_subprocess

Antoine Pitrou report at bugs.python.org
Sat Sep 18 20:24:56 CEST 2010

New submission from Antoine Pitrou <pitrou at free.fr>:

test_subprocess is currently very slow and the main culprit is test_no_leaking (here, it takes 80s out of the 100s needed for the whole run). This tests spawns as many subprocesses as would be needed to reach the max file descriptor limit. Spawning a subprocess is a heavy operation and consequently the test is very long.

This patch adopts another approach: it opens many file descriptors (using os.open()) until the max fd limit is reached, closes some of them (10 is enough) and then launches a bunch of subprocesses in a loop to check that they succeed. Consequently, the test is very fast (even on a Windows VM in debug mode).

components: Tests
files: noleaking.patch
keywords: patch
messages: 116821
nosy: brian.curtin, gregory.p.smith, pitrou, tim.golden
priority: normal
severity: normal
stage: patch review
status: open
title: Speed up test_subprocess
type: performance
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file18921/noleaking.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list