On Mon, 28 Jul 2003, David Wheeler wrote: > On Monday, July 28, 2003, at 06:33 PM, Randy Kobes wrote:
> > What about just skipping the tests if root is running the > > tests, and printing out an explanatory message why the tests > > are skipped? > > I don't think you can necessarily do this, because not all test > need to have access to t/. My test suite for > MasonX::ApacheHandler::WithCallbacks, for example, doesn't need > to have the Apache user access those files. They're loaded up > by the user that starts apache (root), and then the process > forks off to nobody-owned children that never access the files. > So my tests work fine even under root. That's a good point ... As you say below, it'd be better for the test writer to decide on an individual basis which tests should be skipped if run as root. > And since many, _many_ users simply install modules via CPAN.pm > as root, you'd be eliminating a huge group of people who can > run tests. That's true, although that practice is discouraged ... I think this issue has come up in the context of other CPAN modules, where some do skip tests if run as root, for similar reasons - some tests aren't designed for being run as root, and in principle may give false positive (or negative) results if run as such. > I think a better idea is to introduce a test function like > "have_lwp", maybe called "has_access_to_t", that can be used by > the module developer to skip the relevant tests, if necessary. -- best regards, randy