>-----Original Message----- >From: twisted-python-boun...@twistedmatrix.com [mailto:twisted-python- >boun...@twistedmatrix.com] On Behalf Of Jean-Paul Calderone >Sent: Friday, July 03, 2009 11:27 AM >To: Twisted general discussion >Subject: Re: [Twisted-Python] Twisted Trial changes working directory > >On Fri, 3 Jul 2009 10:17:12 -0400, Gerrat Rickert ><grick...@coldstorage.com> wrote: >>I have a (Twisted) program that saves & uses a file in the current >>working directory. >>When running tests for the program, Trial changes the working >directory, >>causing this file to be written into the '_trial_temp' directory >>instead. >>...so the program works differently when run via Trial vs. in normal >>use. > >The only difference I can infer from your description is whether the >file >in question is created in the directory you invoke the program from (in >the non-trial case) or in the _trial_temp subdirectory of that directory >(in the trial case). It's not obvious to me why this might be a >problem.
...and it turns out not to really be a Trial-specific problem - more a problem with my expectations. The file takes a while to generate, and I just expected it to be there after running the program the first time. - it will get regenerated if it doesn't exist, and I can easily copy it to the _trial_temp directory for testing > >> >>There are a number of solutions to this, but I'd just like to >understand >>the reasoning behind this surprising behaviour. >>The docs say that this: "...allows them to write whatever data they >like >>to disk, and not worry about polluting the current working directory" >>...couldn't they just do this without changing the working directory? > >This is an ancient feature of trial, from the days when Twisted's own >test >suite (the primary driver of trial development for many years) was even >more crufty than it is today. In those days, many tests just created >files >in the working directory. The _trial_temp feature provided a single fix >which addressed the mess created by all of the tests in one fell swoop. >The >behavior is still convenient for tests which aren't written carefully in >this regard. > >Jean-Paul Thanks for the explanation. _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python