From: Felix W. <Fel...@gm...> - 2006-04-02 18:34:03
|
David Goodger wrote: > OTOH, tests shouldn't change the working directory unless absolutely > necessary. Well, if they can if it's absolutely necessary, then they can always. > And if they do, they should restore the working directory > in their tearDown methods. Tests shouldn't rely on the working directory anyway because you should be able to run any single test from anywhere in your file system. So it doesn't matter if at the end of a test the working directory has changed. I even think that tests *shouldn't* restore the working directory, because (besides the addition of unnecessary code) if there *is* a problem with the changed working directory, we want it to become apparent as early as possible. Otherwise we end up with subtle test-suite bugs which are only found by users. > Changes to the working directory can cause strange and > difficult-to-trace bugs; As I said, I'd like to trigger strange bugs as early as possible. > it affects the interpretation of sys.path[0] (== ''), for example. Are we using '' in sys.path? I can't find a place where we do. -- For private mail please ensure that the header contains 'Felix Wiemann'. "the number of contributors [...] is strongly and inversely correlated with the number of hoops each project makes a contributing user go through." -- ESR |