[Python-Dev] fixing tests on windows
mail at timgolden.me.uk
Wed Apr 2 10:03:51 CEST 2008
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 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 admit: this did occur to me on the train this am. While I
try to think of a robust way to handle this, other people have
proposed variations on pid-based / tempdir based filenames instead
of the same name for each test. In principle this sounds good to me,
but I'm not at all well-placed to assess the impact it might have
on the unit tests in general.
More information about the Python-Dev