You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I got a false-positive from use_ok() on a module that had been deleted from my distro, but was still being tested for in a test-suite. The reason I got this, is that because I had a previous version of the distro installed, the deprecated module lived under a site_perl somewhere. However, clean tests of my release by people such as CPAN Testers and the Debian team got test failures.
It might be worthwhile to consider having use_ok look at %INC after a successful "use" of the module, and see if it picked it up from lib/blib, or from a system location. Whether this case would warrant a failing test is questionable, but it should at least garner a warning.
The text was updated successfully, but these errors were encountered:
Sorry, but use_ok() is intended as a way to test use statements, not specifically to check the modules in the distribution being tested. Putting a special case check in for where the module loaded from would be against that purpose, reduce its utility and break many existing tests.
The use case you propose has merit, and you're free to write a version of use_ok() that adds the additional check. It's pretty straight forward...
sub use_local_ok {
local $Test::Builder::Level = $Test::Builder::Level + 1;
my($module, @args) = @_;
use_ok($module, @args) or return;
...whatever else you want to add...
}
I'm going to close it up, but feel free to keep discussing.
Recently, I got a false-positive from use_ok() on a module that had been deleted from my distro, but was still being tested for in a test-suite. The reason I got this, is that because I had a previous version of the distro installed, the deprecated module lived under a site_perl somewhere. However, clean tests of my release by people such as CPAN Testers and the Debian team got test failures.
It might be worthwhile to consider having use_ok look at %INC after a successful "use" of the module, and see if it picked it up from lib/blib, or from a system location. Whether this case would warrant a failing test is questionable, but it should at least garner a warning.
The text was updated successfully, but these errors were encountered: