[Twisted-Python] Twisted Trial changes working directory
grickert at coldstorage.com
Fri Jul 3 12:18:26 EDT 2009
>From: twisted-python-bounces at twistedmatrix.com [mailto:twisted-python-
>bounces at 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
><grickert at coldstorage.com> wrote:
>>I have a (Twisted) program that saves & uses a file in the current
>>When running tests for the program, Trial changes the working
>>causing this file to be written into the '_trial_temp' directory
>>...so the program works differently when run via Trial vs. in normal
>The only difference I can infer from your description is whether the
>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
>(in the trial case). It's not obvious to me why this might be a
...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
>>the reasoning behind this surprising behaviour.
>>The docs say that this: "...allows them to write whatever data they
>>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
>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
>in the working directory. The _trial_temp feature provided a single
>which addressed the mess created by all of the tests in one fell swoop.
>behavior is still convenient for tests which aren't written carefully
Thanks for the explanation.
More information about the Twisted-Python