[Python-Dev] Tests failing on Windows with TESTFN
Tim Golden
mail at timgolden.me.uk
Sun Jul 29 04:58:15 EDT 2018
On 29/07/2018 02:04, Jeremy Kloth wrote:
> On Sat, Jul 28, 2018 at 6:43 PM Brett Cannon <brett at python.org>
> wrote:
>> If Windows doesn't clean up its temp directory on a regular basis
>> then that doesn't suggest to me not to use tempfile, but instead
>> that the use of tempfile still needs to clean up after itself. And
>> if there is a lacking feature in tempfile then we should add it
>> instead of a avoiding the module.
>
> Mind you, this is mentioned in the confines of the test harness
> where just about anything can happen (and usually does!). Something
> that cannot be coded against using just tempfile is cleanup on
> process abort. The per-process-directory approach handles this
> case.
>
> I would think it is desired to have no leftovers after running the
> test harness (especially in regards to the buildbots).
>
> Now, I'm not sure the exact cause of all of the leftovers in the
> TEMP directory, but it is definitely something that is currently
> happening (and shouldn't be). It is not exactly the easiest of tasks
> to track the file usage of every test in the test suite. It is
> certainly easier to replace usages of os.unlink with
> test.support.unlink within the test suite.
In the interests of trying to keep a focus to the changes I'm making, I
propose to start again by, as you suggest, making use of
test.support.unlink where it's not currently used. From the evidence I
don't believe that will solve every problem I'm seeing but it should
certainly reduce them.
I do there there's mileage in a wider change to revamp the test suite's
naming and cleanup of temporary files but I'm very wary of trying to
undertake what would undoubtedly be a sprawling and probably contentious
change.
TJG
More information about the Python-Dev
mailing list