Tim Golden wrote: > Gregory P. Smith wrote: >> On Tue, Apr 1, 2008 at 9:13 AM, Tim Golden <[EMAIL PROTECTED]> wrote: >> >>> Tim Golden wrote: > >>> <code> >>> import os, sys >>> import win32file >>> >>> FILENAME = "test" >>> >>> def rename_and_remove (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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com