[Bioperl-l] test data

Sendu Bala bix at sendu.me.uk
Mon Jul 2 13:46:41 UTC 2007


Chris Fields wrote:
> I am planing on adding test data to cvs for eutils and have run across 
> some stuff in bugzilla that needs to be added as well.
> 
> Should we, as convention, start adding data sequestered to a fold with 
> the test name, within t/data?

I'd actually argue that this shouldn't be done: data is sometimes reused 
amongst multiple different test scripts, and when looking for data to 
reuse its easier to spot it in a single directory compared to searching 
through multiple directories.


> This might make life easier in the long 
> run (keep track of files, get rid of old files, etc), and may make it 
> easier for wrapping up the correct data with tests if we start 
> submitting single module CPAN updates.

I don't think that will be an issue. The automated process would read 
the test script and see what input files it uses, copying those into the 
archive. So, just be sure to standardise on using test_input_file() to 
make that possible.


That said, I wouldn't mind especially either way. Just don't do it now, 
since test script names (and therefore the name of the directory you'd 
want to store the input files in) might all change.


In fact we can imagine that we have a test script t/BioZombieKitten.t 
which stores its test data in t/data/BioZombieKitten/input.file but the 
script gets the path to this file by:
my $input_file = test_input_file('input.file');

test_input_file() is then implemented to look for the file in the subdir 
of data corresponding to the script name if we're dealing with the 
900-modules-in-a-package checkout-type situation, but just in t/data if 
we're in the one-module-in-a-package situation.

In any case, things will be most flexible if you drop files directly 
into t/data for now and reference them without any subdirs in the call 
to test_input_file().



More information about the Bioperl-l mailing list