Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Unit testing OS rich code

by DrHyde (Prior)
on Oct 17, 2011 at 10:14 UTC ( #931877=note: print w/ replies, xml ) Need Help??


in reply to Re: Unit testing OS rich code
in thread Unit testing OS rich code

Using a temporary directory for test files is fine, until your tests need to do things that your user can't do. For example, my File::Find::Rule::Permissions needs to behave differently for root and for ordinary users, and the tests also need to create directories and files owned by all kinds of different users and groups.

If my tests are running as an ordinary user, I simply can't create all the structures I need. And if running as root, they *shouldn't*. Dicking about with users and group membership just so my tests can run would be a Really Bad Idea. So I mock up a bunch of filesystem functions so I can test as an ordinary user. Then if my tests are running as root *and* there are appropriate user/group relationships already, I then also create a bunch of test files and run the tests for real.


Comment on Re^2: Unit testing OS rich code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://931877]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-09-21 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls