Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://931877]
[choroba]: erix Seems too complex
[erix]: do you mean: 'it can be done simpler', or 'it won't work' ?
[choroba]: I wouldn't want to maintain it in the current form
[erix]: ok, but mainainability comes after it has been made to work :)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2018-01-19 08:33 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (216 votes). Check out past polls.