[Python-Dev] Tests failing on Windows with TESTFN (original) (raw)

Tim Golden mail at timgolden.me.uk
Sat Jul 28 10:38:23 EDT 2018


On 25/07/2018 16:07, Tim Golden wrote:

One problem is that certain tests use support.TESTFN (a local directory constructed from the pid) for output files etc. However this can cause issues on Windows when recreating the folders / files for multiple tests, especially when running in parallel.

Here's an example on my laptop deliberately running 3 tests with -j0 which I know will generate an error about one time in three: C:\work-in-progress\cpython>python -mtest -j0 testurllib2 testbz2 testimportlib

[... snip ...]

[...] I wanted to ask first whether there was any objection to my converting tests to using tempfile functions which should avoid the problem?

Thanks to those who responded here and/or on the two bpo issues I've already raised:

https://bugs.python.org/issue34239 -- test_bz2 https://bugs.python.org/issue34240 -- test_mmap

Two key questions have been posed in different ways:

  1. Why are these errors occurring? ie are we dodging a root cause issue

  2. Isn't this what test.support.unlink is there to solve?

For (1) I'm putting together a test run using code which I originally wrote for https://bugs.python.org/issue7443 to force the issues out into the open.

For (2), yes: test.support.unlink is supposed to solve that. But it's either not doing enough retries etc. or it's missing a trick.

To be clear: my motivation here isn't some housekeeping or modernisation exercise. I want to get a clear test run on a fresh build on Windows. At present I never get that. I'd be interested to hear from other Windows devs whether they have the same experience?

TJG



More information about the Python-Dev mailing list