There's probably a better approach. When's the last time you were prompted as to whether or not you want to test the module you're about to install? Perhaps not unheard of, but certainly rare. While test dependencies are not rare.
There are other ways to handle it. One solution could be to compose as many tests as practical that don't require this dependency. Then create another group of tests that do require this dependency. Wrap these tests in a SKIP:{...} block, as described in Test::More - Conditional tests.
That way, if the dependency exists, the test will run. If not, you can supply a message about why certain tests are being skipped, and move on.
Of course you do have to decide how important it is for those tests to run. On some of the modules I've been working on recently (Inline related stuff) the tests are critical to assuring that the user will actually be able to use the module. And it's entirely possible for some of my tests to fail on certain systems. You may be in such a situation, or you may be in a situation where the code being tested is pretty reliable and portable -- where a pass on one system is almost certain to equate to a pass on all systems that meet minimum version requirements.
If you're closer to my situation where from one system to the next tests can perform differently, you wouldn't want to skip a critical test. If your module is built on more stable ground, or if the components tested by the dependency are pretty stable, you may be Ok with skipping them.
If you do feel it's important to run the tests on all systems, don't be afraid to pull down a test dependency. It's pretty common to do so.
Dave
In reply to Re^5: How to specify tests dependencies with Makefile.PL?
by davido
in thread How to specify tests dependencies with Makefile.PL?
by OlegG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |