[Bioperl-l] New testing base: BioperlTest.pm

Sendu Bala bix at sendu.me.uk
Mon Jun 25 13:06:27 UTC 2007


Sendu Bala wrote:
> In considering updating all the test scripts to [... use] t/lib/BioperlTest.pm

I'm now in the process of converting all test scripts. In addition to 
those things mentioned previously, BioperlTest now also provides the 
methods test_input_file() and test_output_file().


This:
----
use Bio::Root::IO;
my $output_file = Bio::Root::IO->catfile(qw(t data temp.file));
$obj->new(-file => ">$output_file");

END {
   unlink($output_file);
}

...

$obj->new(-file => Bio::Root::IO->catfile(qw(t data input.file)));
----


Becomes this:
----
my $output_file = test_output_file();
$obj->new(-file => ">$output_file");

...

$obj->new(-file => test_input_file('input.file'));
----


I should think the benefits are obvious, especially for the output 
files, which thanks to inconsistency of using END blocks correctly or at 
all, leaves some output data behind on occasion.

test_input_file() is helpful for the shorthand, but also gets rid of 
many tests' usage of Bio::Root::IO (relying on something you're 
installing and testing in another test script to work in the current 
test script, without testing it in your own test script seems like a 
no-no to me).



More information about the Bioperl-l mailing list