[Python-Dev] fixing tests on windows

Trent Nelson tnelson at onresolve.com
Wed Apr 2 09:00:41 CEST 2008


> 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 haven't looked into all the various places the tests write temp files to, but if we could localise everything to a common root directory, i.e. %TEMP%\python-regrtest, we could then attempt to blow this away at the start of regrtest.py before any tests run, and refuse to run if this fails.  This would be in combination with the unlinking/renaming approach discussed.  This approach seems like it would cover all bases a bit more effectively.

        Trent.


More information about the Python-Dev mailing list