Skip to content

Commit

Permalink
remove Bio::Root::Test, use Test::Most
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Fields committed Jan 17, 2012
1 parent b3d48bc commit 11d8653
Showing 1 changed file with 57 additions and 82 deletions.
139 changes: 57 additions & 82 deletions xt/release/EUtilities.t
@@ -1,94 +1,69 @@
# -*-Perl-*- Test Harness script for Bioperl
# $Id: EUtilities.t 15112 2008-12-08 18:12:38Z sendu $
#

use strict;
our $NUMTESTS;
our $DEBUG;
our %EUTILS;

BEGIN {
$NUMTESTS = 5; # base number of tests (those not in blocks)

# I have set up eutils tests to run in sections for easier test maintenance
# and keeping track of problematic tests. The below hash is the list of
# tests, with test number and coderef.

# these now run very simple tests for connectivity and data sampling
# main tests now with the parser

%EUTILS = (
'efetch' => {'tests' => 5,
'sub' => \&efetch},
'epost' => {'tests' => 11,
'sub' => \&epost},
'esummary' => {'tests' => 254,
'sub' => \&esummary},
'esearch' => {'tests' => 13,
'sub' => \&esearch},
'einfo' => {'tests' => 10,
'sub' => \&einfo},
'elink1' => {'tests' => 8,
'sub' => \&elink1},
'egquery' => {'tests' => 4,
'sub' => \&egquery},
);
$NUMTESTS += $EUTILS{$_}->{'tests'} for (keys %EUTILS);
# this seems to work for perl 5.6 and perl 5.8
use warnings;
use Test::Most;
use Bio::DB::EUtilities; # use_ok tested in 00-compile.t during release

my $test_ct = 1; # base number of tests (those not in blocks)

my %eutils = (
'efetch' => {'tests' => 5,
'sub' => \&efetch},
'epost' => {'tests' => 11,
'sub' => \&epost},
'esummary' => {'tests' => 254,
'sub' => \&esummary},
'esearch' => {'tests' => 13,
'sub' => \&esearch},
'einfo' => {'tests' => 10,
'sub' => \&einfo},
'elink1' => {'tests' => 8,
'sub' => \&elink1},
'egquery' => {'tests' => 4,
'sub' => \&egquery},
);
$test_ct += $eutils{$_}->{'tests'} for (keys %eutils);

plan tests => $test_ct;

my $debug = $ENV{BIOPERLDEBUG} || $ENV{BIOPERL_DEBUG} || 0;
my $email = $ENV{BIOPERL_EMAIL};

use Bio::Root::Test;
$DEBUG = test_debug() || 0;
my ($eutil, $response);

test_begin(-tests => $NUMTESTS,
-requires_modules => [qw(XML::Simple LWP::UserAgent)],
-requires_email => 1,
);
# NOTE : Bio::DB::EUtilities is just a specialized pipeline to get any
# data available via NCBI's Entrez interface, with a few convenience methods
# to get UIDs and other additional information. All data returned
# using EFetch is raw (not Bioperl objects) and is meant to be piped into
# other Bioperl modules at a later point for further processing

use_ok('Bio::DB::EUtilities');
use_ok('LWP::UserAgent');
use_ok('Bio::Tools::EUtilities');
use_ok('Bio::Tools::EUtilities::EUtilParameters');
}
# protein acc
my @acc = qw(MUSIGHBA1 P18584 CH402638);

my $email = $ENV{BIOPERL_EMAIL};
# protein GI
my @ids = sort qw(1621261 89318838 68536103 20807972 730439);

# test search term
my $term = 'dihydroorotase AND human';

my %dbs = (taxonomy => 1,
nucleotide => 1,
pubmed => 1);
my %links = (protein_taxonomy => 1,
protein_nucleotide => 1,
protein_nucleotide_wgs => 1,
protein_pubmed => 1,
protein_pubmed_refseq => 1
);

SKIP: {
ok($email, 'Make sure email is set (BIOPERL_EMAIL)');
skip("Must provide a valid email for tests", $NUMTESTS) if !defined($email);
diag("Using $email for tests") if $DEBUG;

# NOTE : Bio::DB::EUtilities is just a specialized pipeline to get any
# data available via NCBI's Entrez interface, with a few convenience methods
# to get UIDs and other additional information. All data returned
# using EFetch is raw (not Bioperl objects) and is meant to be piped into
# other Bioperl modules at a later point for further processing

# protein acc
my @acc = qw(MUSIGHBA1 P18584 CH402638);

# protein GI
my @ids = sort qw(1621261 89318838 68536103 20807972 730439);

# test search term
my $term = 'dihydroorotase AND human';

my ($eutil, $response);

my %dbs = (taxonomy => 1,
nucleotide => 1,
pubmed => 1);
my %links = (protein_taxonomy => 1,
protein_nucleotide => 1,
protein_nucleotide_wgs => 1,
protein_pubmed => 1,
protein_pubmed_refseq => 1
);

ok($email, 'Make sure email is set (set BIOPERL_EMAIL)');
skip("Must provide a valid email for tests", $test_ct - 1) if !defined($email);
diag("Using $email for tests") if $debug;

# this loops through the required tests, only running what is in %EUTILS
for my $test (keys %EUTILS) {
$EUTILS{$test}->{'sub'}->();
for my $test (keys %eutils) {
$eutils{$test}->{'sub'}->();
}

}
# Simple EFetch

Expand Down

0 comments on commit 11d8653

Please sign in to comment.