[BioRuby] GSOC: Unit testing in BioRuby

Naohisa GOTO ngoto at gen-info.osaka-u.ac.jp
Mon May 25 14:04:22 UTC 2009


Hi,

> libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3,
> 'lib')).cleanpath.to_s
> $:.unshift(libpath) unless $:.include?(libpath)

>     bioruby_root  = Pathname.new(File.join(File.dirname(__FILE__),
> ['..'] * 5)).cleanpath.to_s
>     TEST_DATA = Pathname.new(File.join(bioruby_root, 'test', 'data',
> 'pyloxml')).cleanpath.to_s

The magic number (in the above cases, 3 or 5) depends on
the depth of the directory of the test.

For example,

File location                      The number
test/unit/bio/test_AAA.rb               3
test/unit/bio/BBB/test_AAA.rb           4
test/unit/bio/CCC/BBB/test_AAA.rb       5

-- 
Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org



More information about the BioRuby mailing list