Skip to content

Commit

Permalink
The "libpath magic" in tests are replaced by the load of helper routine.
Browse files Browse the repository at this point in the history
 * In all unit tests, the "libpath magic" are replaced by the load
   of helper routine.
 * Changed to use a constant BioRubyTestDataPath for generating test
   data file path.
 * Some "require" lines are modified.
 * "File.open(...).read" in some tests are replaced by "File.read(...)".
 * Header comment lines of some tests with wrong filename and/or
   class/module name information are fixed.
  • Loading branch information
ngoto committed Sep 14, 2017
1 parent 42d1b3c commit 95a4712
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions test/runner.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env ruby

require 'test/unit'
# loading helper routine for testing bioruby
require 'pathname'
load Pathname.new(File.join(File.dirname(__FILE__),
'bioruby_test_helper.rb')).cleanpath.to_s

bioruby_libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'], 'lib')).cleanpath.to_s
$:.unshift(bioruby_libpath) unless $:.include?(bioruby_libpath)
# libraries needed for the tests
require 'test/unit'

if !defined?(Test::Unit::AutoRunner) then
# Ruby 1.9.1 does not have Test::Unit::AutoRunner
Expand Down
8 changes: 5 additions & 3 deletions test/unit/bio/shell/plugin/test_seq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
# Mitsuteru Nakao <n@bioruby.org>
# License:: The Ruby License
#
# $Id: test_seq.rb,v 1.9 2007/04/05 23:35:44 trevor Exp $
# $Id:$
#

# loading helper routine for testing bioruby
require 'pathname'
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
'bioruby_test_helper.rb')).cleanpath.to_s

# libraries needed for the tests
require 'test/unit'
require 'bio/shell'
require 'bio/shell/plugin/seq'
Expand Down
8 changes: 5 additions & 3 deletions test/unit/bio/test_shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
# License:: The Ruby License
#
# $Id: test_shell.rb,v 1.7 2007/04/05 23:35:42 trevor Exp $
# $Id:$
#

# loading helper routine for testing bioruby
require 'pathname'
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 2,
'bioruby_test_helper.rb')).cleanpath.to_s

# libraries needed for the tests
require 'test/unit'
require 'bio/shell'

Expand Down

0 comments on commit 95a4712

Please sign in to comment.