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

Chris Fields cjfields at uiuc.edu
Wed Jun 20 16:44:01 UTC 2007


Agreed!  You've already created an example case so there's something  
to go off of.

I plan on changing some EUtilities tests soon so I'll try  
implementing this, basing off your RemoteBlast.t implementation.   
Seems clear enough on the surface; if I run into problems I'll post.

chris

On Jun 20, 2007, at 11:27 AM, Hilmar Lapp wrote:

> Very cool! Sounds like a no-brainer to me to adopt this in all the
> tests. -hilmar
>
> On Jun 20, 2007, at 11:38 AM, Sendu Bala wrote:
>
>> In considering updating all the test scripts to take advantage of the
>> new network option, and/or reimplementing them in Test::More, I
>> thought
>> now would be a good time to standardize all the test scripts and
>> reduce
>> the possibility of having to alter them all in the future if  
>> something
>> changes.
>>
>> For example we could decide on an alternate way of choosing to run
>> network tests, or a new way of deciding to output debug information.
>> There are also some inconsistencies in the messages produced by tests
>> skipping all, and even an unfortunate mistake that has been copy/
>> pasted
>> through a lot of test scripts.
>>
>> My solution is t/lib/BioperlTest.pm (documented with perldoc)
>>
>> We go from this:
>>
>> ----
>> use strict;
>> our $DEBUG;
>>
>> BEGIN {
>>    $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
>> 	
>>    eval { require Test::More; };
>>    if( $@ ) {
>>      use lib 't/lib';
>>    }
>>    use Test::More; # the mistake!
>> 	
>>    use Module::Build;
>>    my $build = Module::Build->current();
>>    my $do_network_tests = $build->notes('network');
>>
>>    eval {
>>      require IO::String;
>>      require LWP;
>>      require LWP::UserAgent;
>>    };
>>    if ($@) {
>>      plan skip_all => 'IO::String or LWP or LWP::UserAgentnot
>> installed.
>> This means Bio::Tools::Run::RemoteBlast is not usable. Skipping
>> tests';
>>    }
>>    elsif (!$do_network_tests) {
>>      plan skip_all => 'Network tests have not been requested,  
>> skipping
>> all';
>>    }
>>    else {
>>      plan tests => 21;
>>    }
>>
>>    #...
>> }
>>
>> my $obj = Bio::Object->new(-verbose => $DEBUG);
>> #...
>> ----
>>
>> To this:
>>
>> ----
>> use strict;
>>
>> BEGIN {
>>    use lib 't/lib';
>>    use BioperlTest;
>>
>>    test_begin(-requires_modules => [qw(IO::String LWP
>> LWP::UserAgent)],
>>               -requires_networking => 1,
>>               -tests => 21);
>>
>>    #...
>> }
>>
>> my $obj = Bio::Object->new(-verbose => test_debug());
>> #...
>> ----
>>
>>
>> Can anyone identify problems with this approach? Is the interface
>> presented by BioperlTest flexible enough that any changes would
>> only be
>> additions for new functionality (and therefore all test scripts
>> wouldn't
>> need to be altered)? Is BioperlTest missing anything you'd like?
>>
>> Are there any objections to me updating all tests in this manner?
>> For an
>> example, see t/RemoteBlast.t
>>
>>
>> Cheers,
>> Sendu.
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> -- 
> ===========================================================
> : Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
> ===========================================================
>
>
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign






More information about the Bioperl-l mailing list