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

Scott Dial scott+python-dev at scottdial.com
Wed Apr 2 22:58:03 CEST 2008


Martin v. Löwis wrote:

Is using a fixed TESTFN just an old approach that predates the existence of a robust tempfile module in the standard library? No. I believe the rationale for TESTFN is to provide a fixed name, precisely so that the test suite doesn't leave tons of garbage around.

I figured this was going to be the answer, and I wonder if it would be better to use the tempfile module to generate unique filenames that are all contained in a special directory. It would seem functionally equivalent in the sense that removing the garbage is easy "rmtree(TESTDIR)", and it would also solve the windows problem of files that can't be unlinked. I suppose one would have to periodically clean-up their temp folder of the files left behind, but that's still an improvement over what is currently required if TESTFN is not unlinked.

The only reason I could see the switch being undesirable is if you wanted to go read the test file by hand, but I'm not sure anyone is doing that.

-Scott

-- Scott Dial scott at scottdial.com scodial at cs.indiana.edu



More information about the Python-Dev mailing list