[Python-Dev] [ python-Bugs-1124637 ] test_subprocess is far tooslow (fwd)

Tim Peters tim.peters at gmail.com
Thu Feb 17 18:26:36 CET 2005

[Raymond Hettinger]
>> For test_subprocess, consider adopting the technique used by
>> test_decimal.  When -u decimal is not specified, a small random
>> selection of the resource intensive tests are run.  That way, all of the
>> tests eventually get run even if no one is routinely using -u all.

[Michael Hudson]
> I do like this strategy but I don't think it applies to this test --
> it has to try to create more than 'ulimit -n' processes, if I
> understand it correctly.  Which makes me think there might be other
> ways to write the test if the resource module is available...

Aha!  That explains why test_subprocess runs so much faster on Windows
despite that Windows process-creation time is measured in geological
eras:  test_no_leaking special-cases Windows to do only 65 iterations
instead of 1026.  It's easy to put that under control of a -u option
instead; e.g., instead of

        max_handles = 1026
        if mswindows:
            max_handles = 65

just use 1026 all the time, and stuff, e.g.,

        if not test_support.is_resource_enabled("subprocess"):

at the start of test_no_leaking().

More information about the Python-Dev mailing list