On Wed, Jun 18, 2008 at 1:01 AM, Andreas J. Koenig
<[EMAIL PROTECTED]> wrote:
>>>>>> On Tue, 17 Jun 2008 23:23:00 -0400, "David Golden" <[EMAIL PROTECTED]> 
>>>>>> said:
>
>  > Though I will say that from experience, mocking a home directory isn't
>  > the easiest to do and always get right.
>
> adduser ?

Funny.  No, I'd *really* prefer if test scripts didn't try to add new
user directories.  :-)

My "standard" approach is to have a test setup routine that (a)
creates a temp directory and (b) mocks File::HomeDir to make sure that
all it's methods return the temp directory.  The only real "trick" is
making sure that $INC{File/Homedir.pm} gets set before anything might
possibly load File::HomeDir.

I should probably just wrap it up into a Test::MockHomeDir module.

David

Reply via email to