[Bioperl-guts-l] [15367] bioperl-live/trunk/t/RemoteDB/HIV/HIV.t: use lives_ok instead of eval, and skip based on $@

Christopher John Fields cjfields at dev.open-bio.org
Tue Jan 13 13:27:27 EST 2009


Revision: 15367
Author:   cjfields
Date:     2009-01-13 13:27:27 -0500 (Tue, 13 Jan 2009)

Log Message:
-----------
use lives_ok instead of eval, and skip based on $@

Modified Paths:
--------------
    bioperl-live/trunk/t/RemoteDB/HIV/HIV.t

Modified: bioperl-live/trunk/t/RemoteDB/HIV/HIV.t
===================================================================
--- bioperl-live/trunk/t/RemoteDB/HIV/HIV.t	2009-01-13 18:08:25 UTC (rev 15366)
+++ bioperl-live/trunk/t/RemoteDB/HIV/HIV.t	2009-01-13 18:27:27 UTC (rev 15367)
@@ -6,7 +6,7 @@
 BEGIN {
     use Bio::Root::Test;
     test_begin(
-        -tests => 29,
+        -tests => 30,
         -requires_modules => [qw( XML::Simple HTTP::Request::Common)],
 	);
     use_ok('Bio::DB::HIV');
@@ -50,48 +50,35 @@
 
 # network tests
 SKIP: {
-    test_skip(-tests => 12,
+    test_skip(-tests => 13,
           -requires_networking => 1);
     
     # WebDBSeqI compliance-
     # (this requires network access, since request is built after establishing
     # the LANL session...)
     my $req;
-    eval {$req = $tobj->get_request('mode'=>'single','uids'=>['17756'])};
+    lives_ok {$req = $tobj->get_request('mode'=>'single','uids'=>['17756'])} 'test connection';
     if ($@) {
-        diag("Error: $@");
         skip("Network problems, skipping all tests", 12)
     }
     isa_ok($req, 'HTTP::Request', 'Object returned from get_request');
     # get_... functionality
-    eval {
-        ok($tobj->get_Seq_by_id('17756'), 'get HXB2 by LANL id');
-    };
+    lives_ok { $tobj->get_Seq_by_id('17756') } 'get HXB2 by LANL id';
     if ($@) {
-        diag("Error: $@");
-        skip("Network problems, skipping all tests", 11)
+        skip("Network problems, skipping all tests", 10)
     }
-    eval {
-        ok($tobj->get_Seq_by_acc('K03455'), 'get HXB2 by GB accession');
-    };
+    lives_ok { $tobj->get_Seq_by_acc('K03455');} 'get HXB2 by GB accession';
     if ($@) {
-        diag("Error: $@");
-        skip("Network problems, skipping all tests", 10)
+        skip("Network problems, skipping all tests", 9)
     }    
     my ($seqio, $hxb2);
-    eval {
-        ok($seqio = $tobj->get_Stream_by_id(['17756']), 'get HXB2 in a stream');
-    };
+    lives_ok { $seqio = $tobj->get_Stream_by_id(['17756']) } 'get HXB2 in a stream';
     if ($@) {
-        diag("Error: $@");
-        skip("Network problems, skipping all tests", 9)
+        skip("Network problems, skipping all tests", 8)
     }    
-    eval {
-        ok($seqio = $tobj->get_Stream_by_acc(['K03455']), 'get HXB2 in a stream by accession');
-    };
+    lives_ok { $seqio = $tobj->get_Stream_by_acc(['K03455']) } 'get HXB2 in a stream by accession';
     if ($@) {
-        diag("Error: $@");
-        skip("Network problems, skipping all tests", 8)
+        skip("Network problems, skipping all tests", 7)
     }
     $hxb2 =  $seqio->next_seq;
     is($hxb2->primary_id, 'K03455', 'checking returned stream');




More information about the Bioperl-guts-l mailing list