[Pkg-libvirt-commits] [libguestfs] 67/78: ruby: tests: convert from Test::Unit to MiniTest (RHBZ#1085029)
Hilko Bengen
bengen at moszumanska.debian.org
Fri May 9 12:55:56 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 2f5e9066db817f75b245f256abc0c64dd1ae54eb
Author: Pino Toscano <ptoscano at redhat.com>
Date: Fri Apr 18 11:39:21 2014 +0200
ruby: tests: convert from Test::Unit to MiniTest (RHBZ#1085029)
Convert the tests to the MiniTest test framework, but keeping the usage
of the old Test::Unit as fallback in case MiniTest is not available.
In the latter case, use a bit of "glue" to make the old API look like
the new API, so we can just rely on the newer MiniTest API.
---
ruby/t/tc_010_load.rb | 2 +-
ruby/t/tc_020_create.rb | 4 ++--
ruby/t/tc_030_create_flags.rb | 4 ++--
ruby/t/tc_040_create_multiple.rb | 8 ++++----
ruby/t/tc_050_handle_properties.rb | 4 ++--
ruby/t/tc_060_explicit_close.rb | 4 ++--
ruby/t/tc_070_optargs.rb | 2 +-
ruby/t/tc_100_launch.rb | 2 +-
ruby/t/tc_410_close_event.rb | 2 +-
ruby/t/tc_420_log_messages.rb | 2 +-
ruby/t/tc_800_rhbz507346.rb | 4 ++--
ruby/t/tc_810_rhbz664558c6.rb | 2 +-
ruby/t/tc_820_rhbz1046509.rb | 2 +-
ruby/t/test_helper.rb | 13 ++++++++++++-
14 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/ruby/t/tc_010_load.rb b/ruby/t/tc_010_load.rb
index f1d296c..71fad63 100644
--- a/ruby/t/tc_010_load.rb
+++ b/ruby/t/tc_010_load.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_load
end
end
diff --git a/ruby/t/tc_020_create.rb b/ruby/t/tc_020_create.rb
index 7476439..e033ea5 100644
--- a/ruby/t/tc_020_create.rb
+++ b/ruby/t/tc_020_create.rb
@@ -17,9 +17,9 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_create
g = Guestfs::Guestfs.new()
- assert_not_nil (g)
+ refute_nil (g)
end
end
diff --git a/ruby/t/tc_030_create_flags.rb b/ruby/t/tc_030_create_flags.rb
index 3286a1f..9725a58 100644
--- a/ruby/t/tc_030_create_flags.rb
+++ b/ruby/t/tc_030_create_flags.rb
@@ -17,10 +17,10 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_create_flags
g = Guestfs::Guestfs.new(:environment => false, :close_on_exit => true)
- assert_not_nil (g)
+ refute_nil (g)
g.parse_environment()
end
end
diff --git a/ruby/t/tc_040_create_multiple.rb b/ruby/t/tc_040_create_multiple.rb
index 0d86786..887b8a4 100644
--- a/ruby/t/tc_040_create_multiple.rb
+++ b/ruby/t/tc_040_create_multiple.rb
@@ -17,13 +17,13 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_create_multiple
g1 = Guestfs::Guestfs.new()
g2 = Guestfs::Guestfs.new()
g3 = Guestfs::Guestfs.new()
- assert_not_nil (g1)
- assert_not_nil (g2)
- assert_not_nil (g3)
+ refute_nil (g1)
+ refute_nil (g2)
+ refute_nil (g3)
end
end
diff --git a/ruby/t/tc_050_handle_properties.rb b/ruby/t/tc_050_handle_properties.rb
index 55bb207..85a74ea 100644
--- a/ruby/t/tc_050_handle_properties.rb
+++ b/ruby/t/tc_050_handle_properties.rb
@@ -17,10 +17,10 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_handle_properties
g = Guestfs::Guestfs.new()
- assert_not_nil (g)
+ refute_nil (g)
v = g.get_verbose()
g.set_verbose(v)
v = g.get_trace()
diff --git a/ruby/t/tc_060_explicit_close.rb b/ruby/t/tc_060_explicit_close.rb
index 4752d47..32b3cb9 100644
--- a/ruby/t/tc_060_explicit_close.rb
+++ b/ruby/t/tc_060_explicit_close.rb
@@ -17,10 +17,10 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_explicit_close
g = Guestfs::Guestfs.new()
- assert_not_nil (g)
+ refute_nil (g)
g.close()
end
end
diff --git a/ruby/t/tc_070_optargs.rb b/ruby/t/tc_070_optargs.rb
index b8c23e6..3374880 100644
--- a/ruby/t/tc_070_optargs.rb
+++ b/ruby/t/tc_070_optargs.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_optargs
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_100_launch.rb b/ruby/t/tc_100_launch.rb
index 68fb119..2a3277a 100644
--- a/ruby/t/tc_100_launch.rb
+++ b/ruby/t/tc_100_launch.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_launch
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_410_close_event.rb b/ruby/t/tc_410_close_event.rb
index d0c4465..0a124bd 100644
--- a/ruby/t/tc_410_close_event.rb
+++ b/ruby/t/tc_410_close_event.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_events
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_420_log_messages.rb b/ruby/t/tc_420_log_messages.rb
index 4397e6e..4a84f4a 100644
--- a/ruby/t/tc_420_log_messages.rb
+++ b/ruby/t/tc_420_log_messages.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_events
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_800_rhbz507346.rb b/ruby/t/tc_800_rhbz507346.rb
index 100b1fe..a94872d 100644
--- a/ruby/t/tc_800_rhbz507346.rb
+++ b/ruby/t/tc_800_rhbz507346.rb
@@ -17,13 +17,13 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_rhbz507346
g = Guestfs::Guestfs.new()
g.add_drive_scratch(10*1024*1024)
g.launch()
- exception = assert_raise TypeError do
+ exception = assert_raises TypeError do
g.command(1)
end
assert_match /wrong argument type Fixnum \(expected Array\)/, exception.message
diff --git a/ruby/t/tc_810_rhbz664558c6.rb b/ruby/t/tc_810_rhbz664558c6.rb
index 105035b..f68c8df 100644
--- a/ruby/t/tc_810_rhbz664558c6.rb
+++ b/ruby/t/tc_810_rhbz664558c6.rb
@@ -21,7 +21,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_rhbz664558c6
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_820_rhbz1046509.rb b/ruby/t/tc_820_rhbz1046509.rb
index 831aaf0..5164b88 100644
--- a/ruby/t/tc_820_rhbz1046509.rb
+++ b/ruby/t/tc_820_rhbz1046509.rb
@@ -20,7 +20,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def _handleok(g)
g.add_drive("/dev/null")
g.close()
diff --git a/ruby/t/test_helper.rb b/ruby/t/test_helper.rb
index 8ebfe2f..e58af29 100644
--- a/ruby/t/test_helper.rb
+++ b/ruby/t/test_helper.rb
@@ -15,7 +15,18 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require 'test/unit'
+begin
+ require 'minitest/autorun'
+rescue LoadError
+ require 'test/unit'
+ MiniTest = Test
+ module Test
+ Assertions = Unit::Assertions
+ module Assertions
+ alias refute_nil assert_not_nil
+ end
+ end
+end
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list