[Python-Dev] fixing tests on windows (original) (raw)

Tim Golden mail at timgolden.me.uk
Wed Apr 2 12:00:13 CEST 2008


Tim Golden wrote:

Gregory P. Smith wrote:

On Tue, Apr 1, 2008 at 9:13 AM, Tim Golden <mail at timgolden.me.uk> wrote:

Tim Golden wrote: import os, sys import win32file

FILENAME = "test" def renameandremove (filename): os.rename (filename, filename + ".deleted") os.remove (filename + ".deleted") Isn't this still going to run into problems when the rename fails because the earlier tests remove still left the .deleted file around due to some other running desktop search service that now has the .deleted file open?

I've looked around this issue as far as I can, and I can't come up with a foolproof way of guaranteeing that this won't happen. I considered, eg, trying to open the test file with semantics which preclude FILE_SHARE_DELETE from succeeding (ie stopping the search services / TSVN from getting a handle at all) but I can't find anything which doesn't cause more problems than it solves.

Lest this discussion descend into inactivity, I've done a fresh checkout and I'm producing a patch which will add open_testfile and close_testfile functions to test_support (or something like that) and which will update all the tests to use those. I'm inclined to go with the tempfile approach but at least having the functions means that that could change.

This is obviously a wide-reaching change, but unless anyone's got better ideas, the alternative seems to be intermittently-failing test runs on the Windows buildbots.

TJG



More information about the Python-Dev mailing list