--0003255746f26ce230046d7f5f0f
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Thanks a lot! It worked like a charm!

Diana

On Mon, Jun 29, 2009 at 12:10 PM, David A. Black <dblack / rubypal.com> wrote:

> Hi --
>
>
> On Tue, 30 Jun 2009, Diana Jaunzeikare wrote:
>
>  Hi all,
>>
>> I am developing support for PhyloXML in BioRuby as Google Summer of Code
>> project. I have a question about unit testing.
>>
>> My code depends on libxml-ruby library (other parts of BioRuby does not).
>> So
>> I want to test if libxml-ruby is required and then if it is not, i want to
>> quit my unit test suite (a file tes_phyloxml.rb) nicely (don't perform any
>> unit tests related to phyloxml since they anyways gonna fail) but the rest
>> of unit test suites should continue running.
>>
>> Right now the it completely exits, if can't load xml library, but I would
>> like the other tests to continue running.
>>
>> #First let's test if xml library is here, since it will be required by
>> bio/db/phyloxml
>> begin
>>  require 'xml'
>> rescue LoadError
>>  puts "Please install libxml-ruby library. It is needed for Bio::PhyloXML
>> module. Unit tests will exit now.
>>  exit 1
>> end
>>
>> require 'bio/db/phyloxml'
>>
>>
>> class TestPhyloXML1 < Test::Unit::TestCase
>>
>>    def setup
>>     @phyloxml  io::PhyloXML.new(TestPhyloXMLData.example_xml)
>>   end
>>
>>   def test_init
>>     assert_equal(@phyloxml.class, Bio::PhyloXML)
>>   end
>>
>>  #[...]
>>
>> end
>>
>
> Maybe something like this, if it's not too convoluted:
>
>  no_xml  alse
>
>  begin
>    require 'xml'
>  rescue LoadError
>    puts "No libxml; not running those tests...." # or whatever
>    no_xml  rue
>  end
>
>  unless no_xml
>    class TestPhyloXML1
>
>  etc.
>
>
> David
>
> --
> David A. Black / Ruby Power and Light, LLC
> Ruby/Rails consulting & training: http://www.rubypal.com
> Now available: The Well-Grounded Rubyist (http://manning.com/black2)
> "Ruby 1.9: What You Need To Know" Envycasts with David A. Black
> http://www.envycasts.com
>
>

--0003255746f26ce230046d7f5f0f--