<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, 25 Jul 2018 at 15:16 Tim Golden <<a href="mailto:mail@timgolden.me.uk">mail@timgolden.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm just easing back into core development work by trying to get a <br>
stable testing environment for Python development on Windows.<br>
<br>
One problem is that certain tests use support.TESTFN (a local directory <br>
constructed from the pid) for output files etc. However this can cause <br>
issues on Windows when recreating the folders / files for multiple <br>
tests, especially when running in parallel.<br>
<br>
Here's an example on my laptop deliberately running 3 tests with -j0 <br>
which I know will generate an error about one time in three:<br>
<br>
C:\work-in-progress\cpython>python -mtest -j0 test_urllib2 test_bz2 <br>
test_importlib<br>
<br>
Running Debug|Win32 interpreter...<br>
Run tests in parallel using 6 child processes<br>
0:00:23 [1/3/1] test_urllib2 failed<br>
test test_urllib2 failed -- Traceback (most recent call last):<br>
File "C:\work-in-progress\cpython\lib\test\test_urllib2.py", line <br>
821, in test_file<br>
f = open(TESTFN, "wb")<br>
PermissionError: [Errno 13] Permission denied: '@test_15564_tmp'<br>
<br>
Although these errors are both intermittent and fairly easily spotted, <br>
the effect is that I rarely get a clean test run when I'm applying a patch.<br>
<br>
I started to address this years ago but things stalled. I'm happy to <br>
pick this up again and have another go, but I wanted to ask first <br>
whether there was any objection to my converting tests to using tempfile <br>
functions which should avoid the problem?<br></blockquote><div><br></div><div>I personally don't see any reason to block a move away from TESTFN since it obviously has some inherent issues in parallel test running which means flaky tests.<br></div></div></div>